Thank you, Andrea, for the reply.

I am working on a fix, and if I am successful I will follow the rules. I have 
already built a test function to exercise the issue.

Regards,

Graham

From: andrea.a...@gmail.com [mailto:andrea.a...@gmail.com] On Behalf Of Andrea 
Aime
Sent: Thursday, March 23, 2017 3:01 AM
To: Graham Rhodes ARA/SED
Cc: geotools-devel@lists.sourceforge.net
Subject: Re: [Geotools-devel] Bug in GeoJSON parsing - order of "type" key for 
geometries of GeometryCollection inside a FeatureCollection

Hi,
the bad news is that the gt-geojson module is unsupported:
https://github.com/geotools/geotools/tree/master/modules/unsupported/geojson

The good news is that geotools is open for all and you can contribute a fix for 
it, see the
rules here:
https://github.com/geotools/geotools/blob/master/CONTRIBUTING.md

Cheers
Andrea

On Thu, Mar 23, 2017 at 5:39 AM, Graham Rhodes ARA/SED 
<grho...@ara.com<mailto:grho...@ara.com>> wrote:
Hello,

I believe I have discovered a GeoJSON parsing error when the “type” value of a 
Geometry in a GeometryCollection occurs after the “coordinates” array, for the 
case when the GeometryCollection is in a FeatureCollection. The solution 
previously applied to GeometryHandlerBase solved the problem when using 
GeometryJSON to directly parse a single Geometry, but this does not work when 
parsing a more complete GeoJSON object. (Previous commit was 
https://github.com/geotools/geotools/commit/60cdaf9bd000d5efb49cd781098efccad76ed52e).

Has anyone else seen this? I have spent some time investigating and noticed 
that for input 2, when key == “coordinates” (seen by 
GeometryHandler.startObjectEntry), delegate is already assigned to a 
GeometryCollectionHandler, so that a proxy handler is not assigned and the 
“coordinates” key erroneously gets processed by the GeometryCollectionHandler. 
I will continue investigating a fix, but would welcome any advice or 
information about another solution.

Two test cases are listed below. Input 1, parsed using 
FeatureJSON.readFeatureCollection, will succeed, but input 2 will fail. Both of 
these inputs pass geojsonlint.

-----------------------------------------------------------------------------------
input 1: (FeatureJSON.readFeatureCollection succeeds)
-----------------------------------------------------------------------------------
{
  "type": "FeatureCollection",
  "features": [{
    "type": "Feature",
    "geometry": {
      "type": "GeometryCollection",
      "geometries": [{
           "type": "Polygon",
           "coordinates": 
[[[-90.680724,39.2404],[-90.653574,39.229099],[-90.666135,39.237239],[-90.680724,39.2404]]]
         },
            {
           "type": "Polygon",
           "coordinates": 
[[[-90.680724,39.2404],[-90.653574,39.229099],[-90.666135,39.237239],[-90.680724,39.2404]]]
         }]
    },
    "properties": {
    }
  }]
}

-----------------------------------------------------------------------------------
input 2: (FeatureJSON.readFeatureCollection fails)
-----------------------------------------------------------------------------------
{
  "type": "FeatureCollection",
  "features": [{
    "type": "Feature",
    "geometry": {
      "type": "GeometryCollection",
      "geometries": [{
           "coordinates": 
[[[-90.680724,39.2404],[-90.653574,39.229099],[-90.666135,39.237239],[-90.680724,39.2404]]],
           "type": "Polygon"
         },
            {
           "coordinates": 
[[[-90.680724,39.2404],[-90.653574,39.229099],[-90.666135,39.237239],[-90.680724,39.2404]]],
           "type": "Polygon"
         }]
    },
    "properties": {
    }
  }]
}

Thank you for taking a look.

Graham


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net<mailto:GeoTools-Devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-devel



--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i 
file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo 
è consentito esclusivamente al destinatario del messaggio, per le finalità 
indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne 
il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di 
procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro 
sistema. Conservare il messaggio stesso, divulgarlo anche in parte, 
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, 
costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for the 
attention and use of the named addressee(s) and may be confidential or 
proprietary in nature or covered by the provisions of privacy act (Legislative 
Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in 
accord with its purpose, any disclosure, reproduction, copying, distribution, 
or either dissemination, either whole or partial, is strictly forbidden except 
previous formal approval of the named addressee(s). If you are not the intended 
recipient, please contact immediately the sender by telephone, fax or e-mail 
and delete the information in this message that has been received in error. The 
sender does not give any warranty or accept liability as the content, accuracy 
or completeness of sent messages and accepts no responsibility  for changes 
made after they were sent or for other risks which arise as a result of e-mail 
transmission, viruses, etc.

-------------------------------------------------------
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to