From 529d41e3edbf5c1ca626221acb293d9d793ed3d1 Mon Sep 17 00:00:00 2001 From: Eric Xanderson Date: Sun, 24 Apr 2016 11:17:39 -0500 Subject: [PATCH] Clarified map_coords It's unclear to me that the map_coords function only results in applying a function to the individual dimensions of the tuple. This works well for basic scalling, but if you scale arbitrarily, you lose a lot of the 'geo' part of json, which is the geometric center issue. I've also added a worked example of transforming coords in another pull request with the same scaffold of list comprehension. --- geojson/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/geojson/utils.py b/geojson/utils.py index 5dbf272..15ff320 100644 --- a/geojson/utils.py +++ b/geojson/utils.py @@ -27,15 +27,16 @@ def coords(obj): def map_coords(func, obj): """ - Returns the coordinates from a Geometry after applying the provided - function to the tuples. + Returns the mapped coordinates from a Geometry after applying the provided + function to each dimension in tuples list (ie, linear scaling). :param func: Function to apply to tuples :type func: function :param obj: A geometry or feature to extract the coordinates from. :type obj: Point, LineString, MultiPoint, MultiLineString, Polygon, MultiPolygon - :return: The result of applying the function to each coordinate array. + :return: The result of applying the function to each dimension in the + array. :rtype: list :raises ValueError: if the provided object is not a Geometry. """