Answer the question
In order to leave comments, you need to log in
How to convert data from Openstreetmap to geoJSON?
Hello people.
I want to get the districts of Russia in the form of polygons
, there is a site overpass-turbo.eu/s/xu9 through such a request everything turns out, polygons are displayed. But the data is not returned in polygon format.
There, on that site, there is an "Export" section in the menu and a link "download to geoJSON" by clicking on it, a file with polygons is loaded, etc. exactly what is needed.
Question: how to get such unloading via api now?
Because a query like this:
$client = new Client();
$res = $client->request('GET', 'http://overpass-api.de/api/interpreter', [
'query' => [
'data' => '[out:json];
relation
["addr:country"="RU"]
//["coverage"="polygon"]
["admin_level"=3];
out geom;
',
],
'headers' => [
'Content-Type' => ' application/json'
]
]);
$objects = json_decode($res->getBody()->getContents());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question