[ckan-dev] Representing GeoSpatial polygons: Which is the right format?

Ryan Clark ryan.clark at azgs.az.gov
Wed Apr 3 01:28:17 UTC 2013


The first one, with the nested arrays, is correct according to the GeoJSON specification: http://geojson.org/geojson-spec.html#id4
[ x, y ] is a point
[ [ x1, y1 ], [ x2, y2 ] ] is a line
[ [ [ x1, y1 ], [ x2, y2 ], [ x3, y3 ], [ x1, y1 ] ] ] is a polygon (consists of a set of "rings" so your polygon can have holes in it)

____________________

Ryan Clark
Arizona Geological Survey
ryan.clark at azgs.az.gov
(520) 302-4871







On Apr 2, 2013, at 2:18 PM, Peder Jakobsen <pjakobsen at gmail.com> wrote:

> Hi, 
> 
> The string.Template found in https://github.com/okfn/ckanext-spatial/blob/master/ckanext/spatial/harvesters.py 
> 
> produces this json:  {"type": "Polygon", "coordinates": [[[-119.5, 59], [-119.5, 59.25], [-119, 59.25], [-119, 59], [-119.5, 59]]]}
> 
> On the other hand, dumping and array of points using the geojson lib   found at https://pypi.python.org/pypi/geojson/1.0 
> 
> e.g.   geojson.dumps(geojson.geometry.Polygon(someArrayOfPoints))   produces this:
> 
> {"type": "Polygon", "coordinates": ["70.01 -110.27", "70.102 -110.274", "70.10 -110.2", "70.083604 -110.222364", "70.083824 -110.274833"]}
> 
> Why the nested lists in the first example, and what is the correct way?
> 
> Thanks in advance,
> 
> Peder Jakobsen
> 
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130402/9e8caabb/attachment-0001.html>


More information about the ckan-dev mailing list