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
https://lists.sourceforge.net/lists/listinfo/geotools-devel