Nominatim
提供全球范围的正向/反向地理编码
- 认证方式
- No auth
- HTTPS
- Yes
- CORS
- Yes
- 分类
- 地理编码
简介
Nominatim 是 OpenStreetMap 背后的地理编码引擎:把地名/地址转成坐标(正向地理编码),把坐标转回地址(反向地理编码),数据来自 OSM(ODbL 许可)。公共实例免费使用——但有重要的使用规则(见下)。
快速开始
正向地理编码(实测可用):
curl -A "my-app/1.0 (contact@example.com)" \
"https://nominatim.openstreetmap.org/search?q=berlin&format=json&limit=1"
反向地理编码(这个坐标是什么地方?):
curl -A "my-app/1.0 (contact@example.com)" \
"https://nominatim.openstreetmap.org/reverse?lat=52.52&lon=13.405&format=json"
按 OSM ID 查询:
curl -A "my-app/1.0 (contact@example.com)" \
"https://nominatim.openstreetmap.org/lookup?osm_ids=R62422&format=json"
使用规则(重要!)
- 必须携带描述性的 User-Agent 标识你的应用(实测:没有规范 UA 会返回 HTTP 403 Access denied)。
- 每秒最多 1 次请求——公共实例强制执行。
- 禁止重度/批量使用;未经 Nominatim Data Use 协议不得商业化再分发(基于 OSM 数据,ODbL)。
- 重度生产使用建议自建 Nominatim 实例。
结果包含
每条结果含 lat/lon、place_id、osm_type/osm_id、display_name、type、class、importance,以及地址组件(addresstype、address 对象含道路/城市/国家等)。
认证方式
无需认证——免密钥,但 User-Agent 规则实际上是强制的。
常见问题
Nominatim 免费吗? 公共实例轻量使用免费,限速 1 req/s,且必须携带 User-Agent。
为什么返回 403? 你的 User-Agent 缺失或过于通用——请发送能标识你应用的描述性 UA。
可以商用吗? 轻量使用没问题;重度或商业使用需要 Nominatim Data Use 协议或自建实例。
地理编码 分类更多
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| Actinia Grass GIS Actinia is an open source REST API for geographical data that uses GRASS GIS | API Key | Yes | Unknown | ↗ |
| administrative-divisons-db Get all administrative divisions of a country | No auth | Yes | Yes | ↗ |
| adresse.data.gouv.fr Address database of France, geocoding and reverse | No auth | Yes | Unknown | ↗ |
| Airtel IP IP Geolocation API. Collecting data from multiple sources | No auth | Yes | Unknown | ↗ |
| Apiip Get location information by IP address | API Key | Yes | Yes | ↗ |