jazzband / geojson

Python bindings and utilities for GeoJSON
https://pypi.python.org/pypi/geojson/
BSD 3-Clause "New" or "Revised" License
905 stars 120 forks source link

Utility method to calculate area from geometry #77

Closed nchammas closed 8 years ago

nchammas commented 8 years ago

Would it be appropriate to add a utility method to this library that calculates the area of GeoJSON polygons and multipolygons?

I can port it from this Mapbox Javascript library.

frewsxcv commented 8 years ago

I think any geometric operations and analysis is beyond the scope of this library. This library is just for dealing with the GeoJSON format. If you want to perform an operation like area, I recommend you look at shapely.

http://toblerity.org/shapely/manual.html?highlight=area#object.area

This library (python-geojson), implements the geo interface, so you should be able to do something like this to load a geojson object into shapely.

frewsxcv commented 8 years ago

Thanks for the idea though!

nchammas commented 8 years ago

OK, thanks for the pointer.