Avoid_polygons "Parameter 'avoid_polygons' has incorrect value or format."

Hello
I,ve tried send the post geojson request but have the probem with that:

{“coordinates”:[
[37.544574,55.908039],[37.394027,55.841783]
],
“instructions”:“true”,
“language”:“ru”,
“maneuvers”:“true”,
“options”:{
“avoid_polygons”:{
“type”:“Polygon”,
“coordinates”:[
[
[37.510258,55.899379],[37.512629,55.897921],[37.515381,55.899208],[37.512629,55.901137]
]
]
}
},
“preference”:“fastest”}

and… have the following error:

“error”: {“code”:2000,“message”:
“Parameter ‘avoid_polygons’ has incorrect value or format.”},-“info”:{-“engine”:{“version”:“6.1.0”,“build_date”:“2020-04-06T02:28:47Z”},“timestamp”:1586631943761}}

value or format? Does anybody now what i did wrong here? Please help.

Please format the JSON properly.

1 Like

You can use e.g. http://geojson.io for validation.
You should use proper String quotes ("" not “”)
And a Polygon must have the first point as last point too (5 coordinates for 4 corner polygon)
All easily done using geojson.io

Cheers

HI guys!

I creted geojson with geojson.io:

{
“type”: “FeatureCollection”,
“features”: [
{
“type”: “Feature”,
“properties”: {},
“geometry”: {
“type”: “Polygon”,
“coordinates”: [
[
[
37.470760345458984,
55.88116069922395
],
[
37.49226093292236,
55.88116069922395
],
[
37.49226093292236,
55.89220803668443
],
[
37.470760345458984,
55.89220803668443
],
[
37.470760345458984,
55.88116069922395
]
]
]
}
}
]
}

And create new request:

{“coordinates”:[
[40.23193359375001,56.127184156131065],
[43.69262695312501,56.19448087726972]
],
“radiuses”:[-1,-1],
“maneuvers”:“true”,
“options”:{
“avoid_countries”:[103],
“avoid_polygons”:{“type”:“Polygon”,
“coordinates”:[
[
[37.470760345458984,55.88116069922395],
[37.49226093292236,55.88116069922395],
[37.49226093292236,55.89220803668443],
[37.470760345458984,55.89220803668443],
[37.470760345458984,55.88116069922395]
]
]},“language”:“ru”}

And… it works! Thank you guys very much!

BUT

I’ve new problem. It was a new error 400 and If i got it right, “avoid_polygons” doesn’t work with routes more than 150km. Can i do somthing with that?