You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reproduce the issue take a FeatureCollection that has the example feature [{"geometry": {"coordinates": [-142.505993, 27.779555], "properties": {"dogs": 5, "cats": 6, "frogs": 7}, "type": "Point"}, "properties": {}, "type": "Feature"}]
Then if we run map_coords to divide each coordinate in half
# gj is our FeatureCollection object
gj_prime = geojson.utils.map_coords(lambda x: x / 2, gj)
Then gj_prime will have {"geometry": {"coordinates": [-71.2529965, 13.8897775], "type": "Point"}, "properties": {}, "type": "Feature"}
which correctly applies the coordinate transformation but does not carry over the properties dictionary. Additionally if we look back at the original FeatureCollection gj, it will have also have the transformation applied to its coordinates, and properties dictionary lost.
This does not seem like the intended behavior (or at least should have a 'copy'/'in_place' kwarg) and additionally information during the operation should be preserved.
The text was updated successfully, but these errors were encountered:
To add to this ... the returned object is not actually a "FeatureCollection" or "Feature" object, but instead the dictionary encoded version. In practice this can be seen e.g. during comparison, where one encodes coordinate-tuples to tuples, and not to lists - as in the example above.
To reproduce the issue take a FeatureCollection that has the example feature
[{"geometry": {"coordinates": [-142.505993, 27.779555], "properties": {"dogs": 5, "cats": 6, "frogs": 7}, "type": "Point"}, "properties": {}, "type": "Feature"}]
Then if we run map_coords to divide each coordinate in half
Then gj_prime will have
{"geometry": {"coordinates": [-71.2529965, 13.8897775], "type": "Point"}, "properties": {}, "type": "Feature"}
which correctly applies the coordinate transformation but does not carry over the properties dictionary. Additionally if we look back at the original FeatureCollection gj, it will have also have the transformation applied to its coordinates, and properties dictionary lost.
This does not seem like the intended behavior (or at least should have a 'copy'/'in_place' kwarg) and additionally information during the operation should be preserved.
The text was updated successfully, but these errors were encountered: