How to track polygon like official map

Hi, congratulations for the excellent product.

I’m looking for some examples, i also searched on github, to create something similar to the official version of polygon creation.

I wish I could do something like this:

I have a list of coordinates, I would like to draw a polygon like this.

Is there an example that allows me to do this?

Thank you

Hi @grokier,

In the settings there is an option to not compress the URL (last point in advanced).


You could potentially use this to generate your avoid polygons from the URL.

Bear in mind:

  • that the avoid polygons currently are limited to 200.000 square meters
  • too complex polygons might result in an invalid URL as it has a character limit of around 2000

an example would be:

https://maps.openrouteservice.org/#/directions/Aldi%20S%C3%BCd,Bobenheim-Roxheim,Deutschland/A%20656,Heidelberg,Deutschland/data/%7B%22coordinates%22:%228.34892272949219,49.58133565487736;8.639373779296877,49.41544050977336%22,%22options%22:%7B%22profile%22:%22foot-walking%22,%22preference%22:%22recommended%22,%22options%22:%7B%22avoid_polygons%22:%7B%22type%22:%22MultiPolygon%22,%22coordinates%22:%5B%5B%5B%5B8.400764,49.516293%5D,%5B8.418274,49.52298%5D,%5B8.417931,49.513618%5D,%5B8.417931,49.513618%5D,%5B8.400764,49.516293%5D%5D%5D%5D%7D%7D,%22zoom%22:18%7D%7D

Best regards

hi @amandus , thanks for the help, you have been very helpful.

I don’t want to create a route with a polygon to avoid.

I would just like to create a url with the coordinates that create the polygon, but the url does not update.

if setting a point is mandatory, it must be inside the polygon, not outside, but even setting a point inside the polygon I don’t see the polygon parameters inside the url

@grokier,
after enabeling the uncompressed version in the setting, you have to save, close the popup and recalculate the route or move a point for the setting to take effect.
The coordinates of the MultiPolygon passed as avoid area are then visible in the URL.

It is currently only possible to share polygons in combination with routes (as this is a routing client after all).
Not sure what your use case is, but if you only want to share and view polygons, you could save them as GeoJSON and view them .g. on geojson.io, QGIS or some other GIS software.

Best regards

ok, I couldn’t as I tried to show polygons without using routes.

my goal is to draw a polygon and subsequently determine if a given coordinate is within that polygon.

maybe the solution is geojson, I try to work on it.

thank you