Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The test script is as follows:
- from PyQt4.QtCore import QFileInfo,QString,QStringList
- from qgis.core import *
- QgsApplication([], False) #initialize the qgis application
- QgsApplication.setPrefixPath("/usr/local", True)
- QgsApplication.initQgis()
- print "Version"
- print QGis.QGIS_VERSION
- print "Settings"
- print QgsApplication.showSettings()
- print "Provider list"
- providers=QgsProviderRegistry.instance().providerList()
- for provider in providers:
- print provider
- proj=QgsProject.instance()
- proj.read(QFileInfo("project.qgs"))
- root = QgsProject.instance().layerTreeRoot()
- layer = QgsVectorLayer("Point", "Layer 1", "memory")
- print layer.isValid()
- print "***Adding layer...***"
- QgsMapLayerRegistry.instance().addMapLayer(layer,True)
- proj.write(QFileInfo("output.qgs"))
- And produces the following output:
- Version
- 2.6.1-Brighton
- Settings
- Application state:
- QGIS_PREFIX_PATH env var:
- Prefix: /usr/local
- Plugin Path: /usr/local/lib/qgis/plugins
- Package Data Path: /usr/local/share/qgis
- Active Theme Name:
- Active Theme Path: :/images/themes//
- Default Theme Path: :/images/themes/default/
- SVG Search Paths: /usr/share/qgis/svg/
- /usr/local/share/qgis/svg/
- User DB Path: /usr/local/share/qgis/resources/qgis.db
- Provider list
- memory
- (..others omitted...)
- wms
- True
- ***Adding layer...***
- Segmentation fault
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement