Created
September 29, 2011 15:35
-
-
Save spara/1251012 to your computer and use it in GitHub Desktop.
QGIS standalone python script template for OSX
This file contains 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
# To run the script you must set PYTHONPATH and path to QGIS binaries | |
# | |
# on Linux: export PYTHONPATH=/qgispath/share/qgis/python | |
# on Windows: set PYTHONPATH=c:\qgispath\python | |
# on OSX: export PYTHONPATH=/Applications/QGIS.app/Contents/Resources/python | |
# export PATH="/Applications/QGIS.app/Contents/MacOS/bin:$PATH" | |
from qgis.core import * | |
import sys | |
import os | |
# supply path to where is your qgis installed | |
QgsApplication.setPrefixPath("/Applications/QGIS.app/Contents/MacOS/", True) | |
# load providers | |
QgsApplication.initQgis() | |
# main routine | |
def main(): | |
# code | |
# main | |
if __name__ == '__main__': | |
main() | |
QgsApplication.exitQgis() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment