I have to do some geometrical calculations in 2D(point, lines, line segments and intersection points) in Python, and then use it in GRASS GIS. What is the best library to use for it? I'm trying with SymPy, but I'm not sure is that good choice.


Sympy is inappropriate here (or very difficult to use). For geometrical calculations in 2D, the best solution is Shapely.

But don't forget that GRASS GIS 6.4.x has the module grass.script (look at GRASS Geoprocessing in Python Script) and GRASS GIS 7.x, the new module pygrass.

You can also use the general Python modules GDAL/OGR (osgeo) or Fiona to open and save the GRASS vector files.

After, it is possible to mix all as in GRASS and the Python geospatial modules (Shapely, PySAL,...)

| improve this answer | |
  • Thank You! I hope it's easy to rewrite my code with Shapely. – bartekch Jan 15 '15 at 13:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.