[GeoJSON] polygon orientation, trying number 2

Billy Newman newmanw10 at gmail.com
Sat Jul 16 11:36:11 PDT 2016


To add to the fun and confusion MongoDB uses a CRS that expects counterclockwise ordering of the exterior ring. 

https://docs.mongodb.com/manual/reference/operator/query/geoIntersects/



Sent from my iPhone

> On Jul 16, 2016, at 12:25 PM, Keith Jenkins <kgj2 at cornell.edu> wrote:
> 
> Okay, my last post for today...
> 
> The answers here provide a good overview of the messy situation:
> http://gis.stackexchange.com/questions/119150/order-of-polygon-vertices-in-general-gis-clockwise-or-counterclockwise
> 
> Keith
> 
>> On Sat, Jul 16, 2016 at 2:19 PM, Keith Jenkins <kgj2 at cornell.edu> wrote:
>> Although, to confuse matters, OGC Simple Feature Access seems to
>> specify the opposite:
>> 
>>> The exterior boundary LinearRing defines the “top” of the surface which
>>> is the side of the surface from which the exterior boundary appears to
>>> traverse the boundary in a counter clockwise direction. The interior
>>> LinearRings will have the opposite orientation, and appear as clockwise
>>> when viewed from the “top”,
>> 
>> From section 6.1.11.1 (Polygon, Triangle description)
>> http://www.opengeospatial.org/standards/sfa
>> 
>> Keith
>> 
>>> On Sat, Jul 16, 2016 at 2:12 PM, Keith Jenkins <kgj2 at cornell.edu> wrote:
>>> And exterior-ring-clockwise is how PostGIS interprets the right-hand
>>> rule as well:
>>>    http://postgis.net/docs/manual-2.2/ST_ForceRHR.html
>>> 
>>> Keith
>>> 
>>> On Sat, Jul 16, 2016 at 1:25 PM, Jukka Rahkonen
>>> <jukka.rahkonen at latuviitta.fi> wrote:
>>>> Hi Sean,
>>>> 
>>>> Would you mind to check also if what is written about the right-hand rule is
>>>> correct:
>>>> 
>>>> 
>>>> "Polygon rings MUST follow the right-hand rule for orientation
>>>>      (counter-clockwise external rings, clockwise internal rings)"
>>>> 
>>>> At least the ESRI shapefile specification defines the right-hand rule in an
>>>> opposite way:
>>>> 
>>>> "The order of vertices or orientation for a ring indicates which side of the
>>>> ring
>>>> is the interior of the polygon. The neighborhood to the right of an observer
>>>> walking along
>>>> the ring in vertex order is the neighborhood inside the polygon. Vertices of
>>>> rings defining
>>>> holes in polygons are in a counterclockwise direction. Vertices for a
>>>> single, ringed
>>>> polygon are, therefore, always in clockwise order."
>>>> 
>>>> For me it seems that GeoJSON specification is following the left-hand rule,
>>>> not the right-hand rule.
>>>> 
>>>> -Jukka Rahkonen-
>>>> 
>>>> 
>>>> 
>>>> Sean Gillies kirjoitti 2016-07-16 03:38:
>>>>> 
>>>>> Hi Anna,
>>>>> 
>>>>> Thanks for letting us know about this! I've updated the examples in
>>>>> our GitHub repo and sent a patch along to the RFC Editor. When the
>>>>> GeoJSON standard is published, the examples will have the correct
>>>>> orientation: exterior rings that wind counter-clockwise and interior
>>>>> rings that wind clockwise.
>>>>> 
>>>>> See https://github.com/geojson/draft-geojson/issues/231 for the
>>>>> specific changes.
>>>>> 
>>>>> Yours,
>>>>> 
>>>>> On Thu, Jul 14, 2016 at 4:56 AM, Anna Eivazi
>>>>> <Anna.Eivazi at sharpershape.com> wrote:
>>>>> 
>>>>>> Hello geojson-gurus,
>>>>>> 
>>>>>> First of all, thank you for all your good work about geojson, we
>>>>>> love to use it!;)
>>>>>> 
>>>>>> I’ve got a question after trying to figure out which orientation
>>>>>> to use for polygons.
>>>>>> 
>>>>>> So I’ve read your latest specs:
>>>>>> 
>>>>>> https://datatracker.ietf.org/doc/draft-ietf-geojson/?include_text=1
>>>>>> 
>>>>>> Here it is said:
>>>>>> 
>>>>>> Polygon rings MUST follow the right-hand rule for orientation
>>>>>> 
>>>>>> (counter-clockwise external rings, clockwise internal rings).
>>>>>> 
>>>>>> (clear answer to my question, right?)
>>>>>> 
>>>>>> But a bit upper in the same doc Polygon section:
>>>>>> 
>>>>>> A.3.  Polygons
>>>>>> 
>>>>>> Coordinates of a Polygon are an array of LinearRing (see
>>>>>> 
>>>>>> Section 3.1.6) coordinate arrays.  The first element in the
>>>>>> array
>>>>>> 
>>>>>> represents the exterior ring.  Any subsequent elements represent
>>>>>> 
>>>>>> 
>>>>>> interior rings (or holes).
>>>>>> 
>>>>>> No holes:
>>>>>> 
>>>>>> {
>>>>>> 
>>>>>> "type": "Polygon",
>>>>>> 
>>>>>> "coordinates": [
>>>>>> 
>>>>>> [
>>>>>> 
>>>>>> [100.0, 0.0],
>>>>>> 
>>>>>> [100.0, 1.0],
>>>>>> 
>>>>>> [101.0, 1.0],
>>>>>> 
>>>>>> [101.0, 0.0],
>>>>>> 
>>>>>> [100.0, 0.0]
>>>>>> 
>>>>>> ]
>>>>>> 
>>>>>> ]
>>>>>> 
>>>>>> }
>>>>>> 
>>>>>> That would mean clockwise orientation…?
>>>>>> 
>>>>>> So, which one u are planning to use in future? So we will stick to
>>>>>> it too!
>>>>>> 
>>>>>> Thanks a lot!
>>>>>> 
>>>>>> Best regards,
>>>>>> 
>>>>>> Anna Eivazi
>>>>>> 
>>>>>> _______________________________________________
>>>>>> GeoJSON mailing list
>>>>>> GeoJSON at lists.geojson.org
>>>>>> http://lists.geojson.org/listinfo.cgi/geojson-geojson.org
>>>>> 
>>>>> 
>>>>> --
>>>>> Sean Gillies
>>>>> _______________________________________________
>>>>> GeoJSON mailing list
>>>>> GeoJSON at lists.geojson.org
>>>>> http://lists.geojson.org/listinfo.cgi/geojson-geojson.org
>>>> 
>>>> _______________________________________________
>>>> GeoJSON mailing list
>>>> GeoJSON at lists.geojson.org
>>>> http://lists.geojson.org/listinfo.cgi/geojson-geojson.org
> _______________________________________________
> GeoJSON mailing list
> GeoJSON at lists.geojson.org
> http://lists.geojson.org/listinfo.cgi/geojson-geojson.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geojson.org/pipermail/geojson-geojson.org/attachments/20160716/bacabd9c/attachment-0001.htm>


More information about the GeoJSON mailing list