Created
June 27, 2015 09:43
-
-
Save mtravis/e7aee748a4779996aa42 to your computer and use it in GitHub Desktop.
QGIS Python Function to get map canvas center
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qgis.core import * | |
from qgis.gui import * | |
from qgis.utils import iface | |
@qgsfunction(args=0, group='Custom') | |
def mapCenter(value1,feature, parent): | |
x = str(int(iface.mapCanvas().extent().center().x())) | |
y = str(int(iface.mapCanvas().extent().center().y())) | |
point = x + ',' + y | |
return point |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment