How to Find Which City, District, or Neighbourhood Contains a Location
- API or service
- Boundaries API
- Task
- Latitude and longitude → containing administrative areas
- Examples
- Difficulty
- Beginner
- Time
- 7 min
Find which administrative area contains a location
You have latitude and longitude and need the city, district, neighbourhood, or another named area that contains that point. The Boundaries API part-of endpoint returns matching boundaries from smaller local areas through larger administrative regions.
Task flow: latitude and longitude → Boundaries API → containing boundary features → selected city, district, or neighbourhood.
This differs from reverse geocoding: reverse geocoding finds a nearby address or place, while part-of returns boundary features whose areas contain the input location.
Find containing boundaries
Request administrative, place, and neighbourhood-related boundaries for a point in central Berlin. The query uses separate latitude and longitude parameters.
https://api.geoapify.com/v1/boundaries/part-of?lat=52.52&lon=13.405&boundaries=administrative,place,neighborhood&geometry=point&lang=en&apiKey=YOUR_API_KEY
boundaries is a comma-separated list with up to ten values. The neighborhood filter uses this spelling in the request, while structured response fields can use neighbourhood.
geometry=point returns a representative point and is sufficient when you only need names and identifiers. Request geometry_1000, geometry_5000, or geometry_10000 when you also need simplified boundary polygons; the number is the geometry accuracy in meters.
Reduced response: The full result contains additional datasource, name, and attribution fields.
{
"type": "FeatureCollection",
"features": [
{
"properties": {
"name": "Mitte",
"city": "Berlin",
"district": "Mitte",
"suburb": "Mitte",
"formatted": "Mitte, Berlin, Germany",
"categories": [
"administrative",
"administrative.neighbourhood_level"
],
"place_id": "51a2805a941fcd2a4059e839774dd9424a40f00101f901b6400000000000009203054d69747465"
}
},
{
"properties": {
"name": "Mitte",
"city": "Berlin",
"district": "Mitte",
"formatted": "Berlin, Mitte, Germany",
"categories": [
"administrative",
"administrative.suburb_level"
],
"place_id": "515816571b42b82a4059f6b4288f49444a40f00101f901db3f000000000000c002059203054d69747465"
}
},
{
"properties": {
"name": "Berlin",
"city": "Berlin",
"state": "Berlin",
"formatted": "Berlin, Germany",
"categories": [
"administrative",
"administrative.country_part_level"
]
}
}
]
}
Select the boundary level you need
A point can belong to several overlapping boundaries, and administrative systems differ by country. Do not assume that the first feature is always a city or that every result has a district or neighbourhood field.
Choose a feature using both its structured fields and categories:
| Application needs | Inspect first | Example |
|---|---|---|
| City or municipality | city, then the feature's name and categories |
Berlin |
| District or borough | district or city_district, plus administrative categories |
Mitte |
| Neighbourhood or suburb | neighbourhood or suburb, plus administrative.neighbourhood_level or administrative.suburb_level |
Mitte |
| Stable reference | place_id |
Store it with the selected feature |
| Human-readable context | formatted |
Mitte, Berlin, Germany |
When several features have the same name, their categories, structured fields, and place_id distinguish the underlying boundary levels. Preserve the complete selected feature rather than storing only its display name.
Use lang for localized names where available, but keep a fallback because not every boundary has a name in every language. Also retain datasource attribution from the full API response when displaying or redistributing the data.