Osrm-backend: Remove geojson, go polyline only

Created on 27 Feb 2017  路  4Comments  路  Source: Project-OSRM/osrm-backend

I think we should remove geojson responses and only go with polylines.

Arguments for removal:

  • Polylines are way faster to transfer, especially with big responses the cost of serializing and transferring geojson is huge.
  • There are easy to use polyline encoders available for all major platforms.
  • Removing parameter and code paths makes OSRM leaner and easier to develop.

Arguments against removal:

  • For developers to get started, Geojson is easier to work with than Polyline
  • There is confusion around the polyline coordinate order (it's lat,lon instead of the lon,lat we use everywhere. This is usually not a problem when developers use libraries for parsing the polyline.
  • There is confusion around polyline precision, but since we switched to the standard precision 5 this should be fine now.

/cc @TheMarex

Most helpful comment

Hi. Please, do not remove GeoJSON support. I think, that you underestimate what this format means for other developers! I want to add several additional arguments, against removal:

  • MapBox quick visualization tool geojson.io supports only geoJSON. So it is hard to debug geometry in the response without it.
  • Many GIS application has native GeoJSON support instead of polyline (QGIS, JSOM and many others)
  • You can parse GeoJSON in python without additional libraries, and can not polyline.
  • OSRM server returns JSON encoded answer. It is logical to have a complete JSON response.

By the way. Where you switched to precision 5? I found only precision 6 in sources. https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp#L43

All 4 comments

If you're concerned with response sizes and making OSRM leaner we should talk about

Hi. Please, do not remove GeoJSON support. I think, that you underestimate what this format means for other developers! I want to add several additional arguments, against removal:

  • MapBox quick visualization tool geojson.io supports only geoJSON. So it is hard to debug geometry in the response without it.
  • Many GIS application has native GeoJSON support instead of polyline (QGIS, JSOM and many others)
  • You can parse GeoJSON in python without additional libraries, and can not polyline.
  • OSRM server returns JSON encoded answer. It is logical to have a complete JSON response.

By the way. Where you switched to precision 5? I found only precision 6 in sources. https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp#L43

@gardster internally everything is precision 6, but when we emit polyline we support the google format of precision 5. We also have polyline6 which gives you the full internal precision.

I think GeoJSON is here to stay after all.

Was this page helpful?
0 / 5 - 0 ratings