route360 / r360-js

Route360° JavaScript API (now Targomo)
https://www.targomo.com/developers/
MIT License
174 stars 37 forks source link

GeoJSON is not properly formatted #23

Closed kofronpi closed 8 years ago

kofronpi commented 8 years ago

GeoJSON returned by the server is invalid and does not pass lint tests on /france/v1/polygon when specifying a geojson serializer.

Line 7: the first and last positions in a LinearRing of coordinates must be the same Line 75: the first and last positions in a LinearRing of coordinates must be the same Line 359: the first and last positions in a LinearRing of coordinates must be the same Line 659: the first and last positions in a LinearRing of coordinates must be the same Line 1123: the first and last positions in a LinearRing of coordinates must be the same Line 1351: the first and last positions in a LinearRing of coordinates must be the same Line 1395: the first and last positions in a LinearRing of coordinates must be the same Line 6703: the first and last positions in a LinearRing of coordinates must be the same [...]

Relevant spec from http://geojson.org/geojson-spec.html#polygon:

A LinearRing is closed LineString with 4 or more positions. The first and last positions are equivalent (they represent equivalent points). Though a LinearRing is not explicitly represented as a GeoJSON geometry type, it is referred to in the Polygon geometry type definition.

gerbsen commented 8 years ago

Is this still happening?

kofronpi commented 8 years ago

Yes, although with less warnings than before.

gerbsen commented 8 years ago

Could you please provide a request URL?

kofronpi commented 8 years ago

curl -X GET -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 6e436dbe-49af-f3de-e793-ec1edd44548b" "https://service.route360.net/france/v1/polygon?cfg=%7B%22sources%22%3A%5B%7B%22lat%22%3A48.113844%2C%22lng%22%3A-1.681632%2C%22id%22%3A%22%22%2C%22tm%22%3A%7B%22car%22%3A%7B%7D%7D%7D%5D%2C%22elevation%22%3Atrue%2C%22polygon%22%3A%7B%22serializer%22%3A%22geojson%22%2C%22values%22%3A%5B1800%5D%7D%7D&key=YOUR_KEY"

gerbsen commented 8 years ago

Where do you test the geojson?

gerbsen commented 8 years ago

Well probably here right? http://geojsonlint.com/

kofronpi commented 8 years ago

Yes but I also try to import it into PostGIS to visualize it with QGIS and it fails because of the incorrect format, I have to "clean it up" before.

gerbsen commented 8 years ago

Okay, this is very strange. We are performing this repair operation also on our servers. We will look into this error. Thanks for bringing it up.

gerbsen commented 8 years ago

@kofronpi we just release an improved version of the geojson feature. could you test it again?

gerbsen commented 8 years ago

@kofronpi I just saw that you provided an example request url. I was able to retrieve this with the new version and loaded in qgis. So I'm closing this for now. In case the error persists, just reopen the issue!

curl -X GET -H "Content-Type: application/json" -H "Cache-Control: no-cache" --compressed -H "Postman-Token: 6e436dbe-49af-f3de-e793-ec1edd44548b" "https://service.route360.net/france/v1/polygon?cfg=%7B%22sources%22%3A%5B%7B%22lat%22%3A48.113844%2C%22lng%22%3A-1.681632%2C%22id%22%3A%22%22%2C%22tm%22%3A%7B%22car%22%3A%7B%7D%7D%7D%5D%2C%22elevation%22%3Atrue%2C%22polygon%22%3A%7B%22serializer%22%3A%22geojson%22%2C%22values%22%3A%5B1800%5D%7D%7D&key=uhWrWpUhyZQy8rPfiC7X" > x.geojson

screenshot 2016-07-14 17 13 09

kofronpi commented 8 years ago

@gerbsen it seems to work fine for now. I'll tell you if I find any new bugs ! :+1: Did you guys change the area returned in the payload with this update ?

gerbsen commented 8 years ago

@kofronpi what exactly do you mean with "change the area"?