[Qgis-developer] Problems using QgsGeometryAnalyzer.simplify() on Mac OS?

Nathan Woodrow madmanwoo at gmail.com
Wed Jan 23 20:39:45 PST 2013


Chris,

Try this

layer = QgsVectorLayer("/Users/[me]/ar-02.kml","ar-02","ogr")

- Nathan
From: Chris B
Sent: 24/01/2013 2:16 PM
To: qgis-developer at lists.osgeo.org
Subject: [Qgis-developer] Problems using QgsGeometryAnalyzer.simplify()
on Mac OS?
Hello,

New to QGIS, I'm using it to hopefully simplify some complex KML geometry.
I can get it to run from the Terminal fine, but can't seem to find the
correct syntax to actually simplify the polygon.

Here's what I've tried:


$ export
DYLD_LIBRARY_PATH=/Applications/Qgis.app/Contents/MacOS/lib:/Applications/Qgis.app/Contents/Frameworks
$ export PYTHONPATH=/Applications/Qgis.app/Contents/Resources/python
$ python

>>> from qgis.core import *
>>> QgsApplication.setPrefixPath("/Applications/Qgis.app/Contents/MacOS/QGIS")
>>> QgsApplication.setPrefixPath("/Applications/Qgis.app/Contents/MacOS/QGIS",True)
>>> QgsApplication.initQgis()
>>> layer = QgsVectorLayer("/Users/[me]/ar-02.kml","ar-02","kml")
>>> layer
<qgis.core.QgsVectorLayer object at 0x110576c20>
>>> from qgis.analysis import QgsGeometryAnalyzer
>>> QgsGeometryAnalyzer().simplify(layer,"/Users/cbarnes/testout.shp",0.005,False)
False

I get the False result whether trying to use Qgis from the Terminal or
inside the Python console in the GUI.  What's interesting is if I manually
load a layer into the GUI, the simplification works fine:

>>> qgis.utils.iface
>>> layer = qgis.utils.iface.activeLayer()
>>> from qgis.analysis import QgsGeometryAnalyzer
>>> QgsGeometryAnalyzer().simplify(layer,"test",0.005,False)
True

(I can't seem to get QGIS to load a layer from the console, but that's OK if
I can get a shell script to work)

Is there anything obvious I am doing wrong?

Thanks for any help you can provide,




--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/Problems-using-QgsGeometryAnalyzer-simplify-on-Mac-OS-tp5029433.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list