NetTopologySuite.IO.GeoJSON does not handle geometries where coordinates or geometries are listed before type (patch included)

93 views
Skip to first unread message

Atle Sveen

unread,
Aug 19, 2014, 4:13:04 AM8/19/14
to nettopol...@googlegroups.com
Hello list!

We've been using NetTopologySuite.IO.GeoJSON in a project and discovered that it crashed on a valid GeoJSON file. 

This file had the geometry laid out like this: 

"geometry": {
       
"coordinates": [
         
-2.67,
         
61.1766667
       
],
       
"type": "Point"
     
}
Which is valid GeoJSON according to http://geojsonlint.com/, but this crashed NetTopologySuite.IO.GeoJSON, due to the sequential reading of the JSON.

A patch that remedies this is included, with several tests added in GeoJsonReaderTest.cs. 

Feel free to ask for clarification on anything in the patch, I am by no means a C#-pro, so there may be style issues and things may differ from any NetTopologySuite conventions that I am not aware of
geojson_ordering.diff

Diego Guidi

unread,
Aug 19, 2014, 5:17:43 AM8/19/14
to nettopol...@googlegroups.com
thanks for the patch: currently we're moving code and issue tracker to
github, so I hope to add your patch when move is completed.
btw: with what version do you experienced the problem? I was sure I've
fixed order issues at least in the trunk...

Diego Guidi
> --
> You received this message because you are subscribed to the Google Groups
> "NetTopologySuite" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nettopologysui...@googlegroups.com.
> To post to this group, send email to nettopol...@googlegroups.com.
> Visit this group at http://groups.google.com/group/nettopologysuite.
> For more options, visit https://groups.google.com/d/optout.

Atle Sveen

unread,
Aug 19, 2014, 9:52:07 AM8/19/14
to nettopol...@googlegroups.com
Ah, github is great for future contributions!

I've found this issue in trunk (checked out from http://nettopologysuite.googlecode.com/svn/trunk/) latest rev I have is r1256 (and this is the rev the patch is based on

I added the test "GeoJsonReaderReadFeatureWithCoordinatesBeforeTypeTest" in GeoJsonReaderTest.cs before I made any changes, and this failed, so I'm rather sure there are ordering issues in that rev at least 
 

Atle Sveen

unread,
Aug 27, 2014, 4:09:27 AM8/27/14
to nettopol...@googlegroups.com
Seeing that you've moved the project to GitHub now (which is great!), I cannot see that you've applied my patch yet?

Are you planning on doing so, or should i clone the github repo and send it as a pull request there?

(that is, if you think the patch is worth taking into NTS at all ;))


On Tuesday, 19 August 2014 10:13:04 UTC+2, Atle Sveen wrote:

Diego Guidi

unread,
Aug 27, 2014, 4:57:04 AM8/27/14
to nettopol...@googlegroups.com
I 'haven't applied your patch yet: actually I need to take a look but
definitively sorting issues are present in GeoJSON code and needs to
be fixed.
I think I should work on it soon, but if you agree we should try with
git pull request :)
Feel free to clone the repo and make your changes.



Diego Guidi

Atle Sveen

unread,
Aug 28, 2014, 5:27:52 AM8/28/14
to nettopol...@googlegroups.com
Great!

I'll create a pull request as soon as the organization that pays my hours gets to register their own github organization, to give credit where credit's due etc ;)

Diego Guidi

unread,
Sep 4, 2014, 2:02:16 AM9/4/14
to nettopol...@googlegroups.com


On Thursday, August 28, 2014 11:27:52 AM UTC+2, Atle Sveen wrote:
I'll create a pull request as soon as the organization that pays my hours gets to register their own github organization, to give credit where credit's due etc ;)

Hope to take a look sooner :) 

Diego Guidi

unread,
Sep 15, 2014, 8:52:10 AM9/15/14
to nettopol...@googlegroups.com


On Thursday, September 4, 2014 8:02:16 AM UTC+2, Diego Guidi wrote:

Hope to take a look sooner :) 

I'm working on this stuff 

Diego Guidi

unread,
Sep 15, 2014, 9:17:50 AM9/15/14
to nettopol...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages