geojson icon indicating copy to clipboard operation
geojson copied to clipboard

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

Open frewsxcv opened this issue 10 years ago • 3 comments

frewsxcv avatar Sep 30 '14 04:09 frewsxcv

I agree! Note in ver 2.1.0:

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

should be a geojson.geometry.

dharasty avatar Apr 23 '18 19:04 dharasty

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.

rayrrr avatar Jul 14 '19 13:07 rayrrr

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.

stefano-xy avatar Sep 17 '21 11:09 stefano-xy