1

What is the best way to handle geometries between different Python functions? For example: I have a function that exports a line from grass.script. The line will be a parameter of another function where it will be passed in.

Is it best to export them to WKT, or safe them in a GPX, or GeoJSON? The formats OGR offers are endless. But which one is most recommended?

  • ? Just pass the OGRGeometry into the next function? Python doesn't care what the type is as long as it has those attributes you need to use. – Nathan W Oct 17 '13 at 22:09
  • @NathanW I edited my Question. In my case I export it with Grass v.out.ogr. So I cannot just use the OGRGeometry. – ustroetz Oct 17 '13 at 22:20
  • depends on your source object and the target. For instance i wrote my self some neat little functions to convert geometry objects between QGsGeometry and the gdal-geometry class and vice-versa. If you just wanna export your geometries than i would suggest you save them to wkt. It can easily be edited and loaded into QGIS if necessary – Curlew Oct 17 '13 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.