Open LiberQuack opened 8 years ago
Thanks for mentioning this. I haven't tried these classes with MongoDB yet. I would assume that mongo would serialize the LngLatAlt class as an object with several properties instead of an array. Is this right? Could you please share some code and/or how Mongo saves this?
@notanyron in this situation an array for all properties would be better ;)
"geometry" : {
"type" : "FeatureCollection",
"features" : [
{
"type" : "Feature",
"properties" : {
},
"geometry" : {
"type" : "Point",
"coordinates" : [
"36.394900225",
"-24.135984854"
]
}
}
]
}
When deserilizing the LngLatAlt object i.e. the coordinates array under geometry, Unexpected token (VALUE_STRING) when binding data into LngLatAlt
exception is thrown.
I believe the LngLatAltSerializer needs to be fixed as well. If you look at the geoJson specifications position data should be given as an array of doubles not strings. http://geojson.org/geojson-spec.html#geometry-objects
Theres also the problem that the Double to String conversion in LngLatAltSerializer is performed on lng and lat but not alt. So a 3d point ends up with two strings and a double.
I came accorss this problem when I was trying to use geojson generated by this api with MongoDB. MongoDB is designed to work wth the geoJson spec and so cannot create indexes for the generated geoJson as it expects arrays of Doubles not Strings when dealing with locations.
This problem could be corrected by removing the fastDoubleToString method from the LngLatAltSerializer.
Did you fix this?
The fix has been merged, LngLatAlt positions serialize to an array of doubles now
After saving a Point into MongoDB I realized it converts double to String
As I know... GeoJSON specify numbers inside the array coordinates. Am I wrong?