import requests query = """ [out:csv(::id,name)]; relation[admin_level="2"]; out; """ response = requests.get( 'http://overpass-api.de/api/interpreter', headers = {'Accept-Charset': 'utf-8'}, params = {'data' : query } ) response.encoding='utf-8' with open('overpass-result.csv', 'w', encoding='utf-8') as file: file.write(response.text)
$query = @' [out:json]; nwr [name=Freienstein]; out; '@ $res = invoke-webRequest -method post -body (@{'data' = $query}) https://overpass-api.de/api/interpreter $resTxt = $res.Content $resJson = convertFrom-json $resTxt foreach($elem in $resJson.elements) { "id: $($elem.id) ($($elem.type))" if ($elem.type -eq 'node') { " $($elem.lat) $($elem.lon)" } … }
*.overpassql
. length()
function, the calculation of distances (notably between two nodes) seems impossible. {{geocodeArea:Pfungen}}; // Search in Pfungen nw // Search nodes and ways [building] // that have a building and ['addr:housenumber'] // an addr:housenumber tag. (area) // Restrict search to selected area (geocodeArea) (if: t['addr:housenumber'] == 13 ); // and keep only those objects whose addr:housenumber value is 13 out geom;
osmplotr
creates visually impressive customisable images of OpenStreetMap data downloaded internally via the Overpass API.