Closed disarticulate closed 8 years ago
It looks like I don't understand the underlying map issue.
Also the documentation in the readme
...
elif obj['type'] in ['LineString', 'MultiPoint']:
coordinates = [tuple(map(func, c)) for c in obj['coordinates']]
...
This code causes func
to get applied on every numeric value within a coordinate for all coordinates
.
If it were:
...
elif obj['type'] in ['LineString', 'MultiPoint']:
coordinates = [tuple(map(func, obj['coordinates']))]
...
Then it would like you say and apply func
on every coordinate tuple.
If you know a way to make the documentation more clear about this, feel free to open a pull request. Let me know if you have any other issues!
I've added two forks. One to update the documentation to clarify the dimension of the mapping function. Another with a general utility based on the mapping function to take a function which operates on tuples. https://github.com/disarticulate/python-geojson/commit/8492796a7c4ef5d5b1df2b4f996a214670a01d55 https://github.com/disarticulate/python-geojson/commit/c58f1cbdee3b55269e334b4503ed4fd766b378ba
I'm doing this test case:
print(geojson.map_coords.__doc__)
I expected print(x) to bu a tuple? As the doc says 'after applying the provided function to the tuples. Am I missing something? My conversions.LFtoLongLat expect a tuple, as I'm doing an affine transformation.