NetTopologySuite / NetTopologySuite.IO.GeoJSON

GeoJSON IO module for NTS.
BSD 3-Clause "New" or "Revised" License
111 stars 46 forks source link

interpolated property #94

Closed GioviQ closed 2 years ago

GioviQ commented 2 years ago

Using https://docs.mapbox.com/api/search/geocoding/#forward-geocoding

I have GeoJSON with

"geometry": { "type": "Point", "coordinates": [ -117.267131, 32.959175 ], "interpolated": true }

Parsing "interpolated" gives exception.

"interpolated" seems not a proper GeoJSON property.

Am I right?

DGuidi commented 2 years ago

GeoJSON feature object doesn't allow "interpolated" property as a "root" property, so I assume that the map box return message is not a valid GeoJSON? Nope, the return is a geoJSON feature collection, so I will do a check ASAP to see what happens

GioviQ commented 2 years ago

Root property? The above is only the Json part to present the issue, not the full response. To MapBox interpolated is a property of Point and maybe all other geometries.

DGuidi commented 2 years ago

What I meant is that a feature object in GeoJSON should have "geometry", "properties", "type" and "id" properties only. So the "interpolated" property is a bit unexpected at this level.

DGuidi commented 2 years ago

foreign members are allowed, so the geojson code should be deserialized. Ok, now I understand the problem: the "interpolated" property is part of the geometry, not the "root object". Sorry, yesterday I answered from the phone and I totally missed this. Anyway... Can you post the complete data that throws the exception and some details about the error itself (i.e.: the exception type)? A unit test code should be fantastic.

GioviQ commented 2 years ago

If you go in https://docs.mapbox.com/playground/geocoding/?search_text=1043%20Coast%20Blvd%20S%2CLa%20Jolla%2CCA%2C92037&types=place%2Cpostcode%2Caddress

look for feature[3] in the response tab

GioviQ commented 2 years ago

To discover the error I had to debug this repository because the exception is not clear. Newtonsoft: Expected token '}' not found Stj: StjGeometryConverter read too much or not enough

DGuidi commented 2 years ago

So the problem lies in both NetTopologySuite.IO.GeoJSON4 and NetTopologySuite.IO.GeoJSON4STJ libraries. I discovered the problem, basically (and for NetTopologySuite.IO.GeoJSON4) the serializer is not advanced after that the additional properties is read. Working on it.