jazzband / geojson

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

map_coords should return a python-geojson object geometry object instead of dictionary #42

Open frewsxcv opened 10 years ago

dharasty commented 6 years ago

I agree! Note in ver 2.1.0:

type(geojson.utils.map_coords(some_func, some_geometry)) == <type 'dict'>

should be a geojson.geometry.

rayrrr commented 5 years ago

Point of clarification: "Geometry" is an abstract class and an abstract concept in the GeoJson spec. It is not an actual Type itself. So, is what we are saying here that whatever Type of object gets mapped, that same Type of object should be returned?

We just did that for the Feature Type (to address #110) so it should be straightforward to extend it to the other Types.

stefano-xy commented 3 years ago

I think the suggestion is to return one of the classes Point, LineString, ... so concrete classes. The return type of the function should be Geometry, if I'm not mistaken. Maybe we should have a separate new function, to_geometry.

Related to this request, it would be nice to have a standalone function to check if a Mapping containing type and coordinates is indeed a valid GeoJSON. For this I think I'll open a new issue.