DEV Community

Godadevi
Godadevi

Posted on

studying OSM API endpoints for localizaton update

Understanding OSM APIs
There are two major APIs you should know:
OpenStreetMap Core API (Editing Data)
This API is mainly used for reading and updating map data.
Important Endpoints:
/api/0.6/node/{id} → Get node details
/api/0.6/way/{id} → Get roads/buildings
/api/0.6/relation/{id} → Complex map sructures
/api/0.6/map → Fetch data in a bounding box
/api/0.6/node/create → Create a node
/api/0.6/node/{id} (PUT) → Update node
Localization Use Case:
You can update multilingual names using tags like:
name = Temple
name:te = దేవాలయం
name:ta = கோவில்
This helps display names in regional languages.

Overpass API (Fetching Data)
This is a read-only API used to query map data efficiently.
Endpoint:
https://overpass-api.de/api/interpreter
Query Language:
Overpass QL

Fetch Nearby Places Using Python
import requests
url = "https://overpass-api.de/api/interpreter"
query = """
[out:json];
node
"amenity"="place_of_worship";
out;
"""
response = requests.post(url, data=query)
data = response.json()
for element in data["elements"]:
name = element["tags"].get("name", "No Name")
lat = element["lat"]
lon = element["lon"]
print(f"{name} - ({lat}, {lon})")
output
Nearby Temples:

No Name - (16.506972, 80.6474935)
All Nations Church - (16.5063605, 80.6456832)
No Name - (16.5091461, 80.6458725)
Heaven's Way Chruch - (16.5064485, 80.6398785)
Blessings Chruch - (16.506598, 80.6398703)
Sri Venkateswara Swami Vari Devastanam - (16.5093066, 80.6398283)
Ganesh Temple - (16.5054215, 80.6513258)

Top comments (0)