Open mike-sosa-sofarocean opened 4 years ago
Can confirm. map_
functions should preserve properties.
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.
Is there any update on this?
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.