geosolutions-it / geoserver

Official GeoServer repository
http://geoserver.org
Other
10 stars 7 forks source link

Geoserver importer fails at parsing a GeoJSON containing decimal numbers #332

Open giohappy opened 2 years ago

giohappy commented 2 years ago

When trying to import this dataset the Geoserver importer (2.19.x) throws the following error:

2022-04-12 21:57:30,417 ERROR [geoserver.rest] - Found conflicting types Double and Long for property mag
java.lang.IllegalStateException: Found conflicting types Double and Long for property mag
    at org.geotools.geojson.feature.FeatureTypeHandler.primitive(FeatureTypeHandler.java:160)
    at org.json.simple.parser.JSONParser.parse(JSONParser.java:428)
    at org.json.simple.parser.JSONParser.parse(JSONParser.java:312)
    at org.geotools.geojson.GeoJSONUtil.parse(GeoJSONUtil.java:280)
    at org.geotools.geojson.feature.FeatureJSON.readFeatureCollectionSchema(FeatureJSON.java:503)
    at org.geoserver.importer.format.GeoJSONFormat.task(GeoJSONFormat.java:152)
    at org.geoserver.importer.format.GeoJSONFormat.list(GeoJSONFormat.java:142)
    at org.geoserver.importer.Importer.createTasks(Importer.java:687)
    at org.geoserver.importer.Importer.initForDirectory(Importer.java:584)
    at org.geoserver.importer.Importer.addTasks(Importer.java:501)
    at org.geoserver.importer.Importer.update(Importer.java:474)
    at org.geoserver.importer.rest.ImportTaskController.acceptData(ImportTaskController.java:294)
    at org.geoserver.importer.rest.ImportTaskController.taskPost(ImportTaskController.java:194)
    at sun.reflect.GeneratedMethodAccessor903.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
aaime commented 2 years ago

For a general discussion on the state of GeoJSON import, see https://github.com/geosolutions-it/geoserver/issues/323

Specifically for this one, I've tested with 2.21.x and found that parsing works, but import fails to create target table... ah it does because I tried to import an array before, what a pain. Opened a ticket for it. Otherwise the import works fine.

So in terms of estimates:

I'm adding another estimate entry for the other ticket, since the postgis issue is related to handling arrays.