Zh-hans:Nominatim

From OpenStreetMap Wiki
Jump to: navigation, search
可用语言 — Nominatim
· Afrikaans · Alemannisch · aragonés · asturianu · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Bân-lâm-gú · Basa Jawa · Baso Minangkabau · bosanski · brezhoneg · català · čeština · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · Kurdî · latviešu · Lëtzebuergesch · lietuvių · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk bokmål · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · português do Brasil · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 吴语 · 粵語 · 中文(繁體)‎ · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް

Nominatim(来自拉丁语,意思是“名称”)是一个可以按名称和地址来搜索OSM中的数据,并生成OSM点的合成地址的工具(反向地理编码)。可用在http://nominatim.openstreetmap.org找到这个工具。Nominatim也用在OpenStreetMap首页搜索工具栏中,同时也为MapQuest Open Initiative, PickPoint, OpenCage Geocoder提供搜索支持。

本页面提供了使用说明。要了解关于Nominatim如何工作的细节请查看发展概况以及这个FAQ。这里还有一个关于各个国家的语言代码各个国家地址格式的列表。

如果你在搜索结果中发现了问题请协助提交一个测试案例通过trac上报bug。参见第2版的笔记。

搜索

Nominatim为OSM的数据集中已命名(或编号)的内容,以及其他无名的功能子集(酒吧,旅馆,教堂等)进行了索引。

搜索首先会从左至右进行,如果失败的话会再从右到左搜索。

这两个搜索都会得到结果:皮尔金顿大道,伯明翰 伯明翰,皮尔金顿大道

(逗号是可选的,但加上逗号可以降低搜索的复杂程度并提高搜索精度。)

门牌号码已经被定义了的区域,可以使用:135皮尔金顿大道,伯明翰

特殊的关键词

在搜索中不同的关键字会被翻译成特定OSM标签(例如,酒吧=>市容=酒馆)。这里有一个这样特殊短语的列表。

参数

 http://nominatim.openstreetmap.org/search?<params>
 http://nominatim.openstreetmap.org/search/<query>?<params>
 format=[html|xml|json|jsonv2]
   Output format
 json_callback=<string>
   Wrap json output in a callback function (JSONP) i.e. <string>(<json>) 
 accept-language=<browser language string>
   Preferred language order for showing search results, overrides the browser value.  
   Either uses standard rfc2616 accept-language string or 
   a simple comma separated list of language codes.
 q=<query>
   Query string to search for.  Alternatively can be entered as:
 street=<housenumber> <streetname>
 city=<city>
 county=<county>
 state=<state>
 country=<country>
 postalcode=<postalcode>
   (experimental) Alternative query string format for structured requests. 
   Structured requests are faster and require less server resources. 
   DO NOT COMBINE WITH q=<query> PARAMETER.
 countrycodes=<countrycode>[,<countrycode>][,<countrycode>]...
   Limit search results to a specific country (or a list of countries).  
   <countrycode> should be the ISO 3166-1alpha2 code, 
   e.g. gb for the United Kingdom, de for Germany, etc.
 viewbox=<left>,<top>,<right>,<bottom>
 or viewboxlbrt=<left>,<bottom>,<right>,<top>
   The preferred area to find search results
 bounded=[0|1]
   Restrict the results to only items contained with the bounding box. 
   Restricting the results to the bounding box also enables searching by amenity only. 
   For example a search query of just "[pub]" would normally be rejected
   but with bounded=1 will result in a list of items matching within the bounding box.
 polygon=[0|1]
   Output polygon outlines for items found 
   (deprecated, use one of the polygon_* parameters instead)
 addressdetails=[0|1]
   Include a breakdown of the address into elements
 email=<valid email address>
   If you are making large numbers of request please include a valid email address
   or alternatively include your email address as part of the User-Agent string.
   This information will be kept confidential and only used to contact you in the
   event of a problem, see Usage Policy for more details.
 exclude_place_ids=<place_id,[place_id],[place_id]>
   If you do not want certain openstreetmap objects to appear in the search result, 
   give a comma separated list of the place_id's you want to skip.
 limit=<integer>
   Limit the number of returned results.
 dedupe=[0|1]
   No explanation yet.
 debug=[0|1]
   No explanation yet.
 polygon_geojson=1
   Output geometry of results in geojson format.
 polygon_kml=1
   Output geometry of results in kml format.
 polygon_svg=1
   Output geometry of results in svg format.
 polygon_text=1
   Output geometry of results as a WKT.

示例

 http://nominatim.openstreetmap.org/search?q=135+pilkington+avenue,+birmingham&format=xml&polygon=1&addressdetails=1
 http://nominatim.openstreetmap.org/search/135%20pilkington%20avenue,%20birmingham?format=xml&polygon=1&addressdetails=1
 http://nominatim.openstreetmap.org/search/gb/birmingham/pilkington%20avenue/135?format=xml&polygon=1&addressdetails=1
 <searchresults timestamp="Sat, 07 Nov 09 14:42:10 +0000" querystring="135 pilkington, avenue birmingham" polygon="true">
   <place 
     place_id="1620612" osm_type="node" osm_id="452010817" 
     boundingbox="52.548641204834,52.5488433837891,-1.81612110137939,-1.81592094898224" 
     polygonpoints="[['-1.81592098644987','52.5487429714954'],['-1.81592290792183','52.5487234624632'],...]" 
     lat="52.5487429714954" lon="-1.81602098644987" 
     display_name="135, Pilkington Avenue, Wylde Green, City of Birmingham, West Midlands (county), B72, United Kingdom" 
     class="place" type="house">
     <house>135</house>
     <road>Pilkington Avenue</road>
     <village>Wylde Green</village>
     <town>Sutton Coldfield</town>
     <city>City of Birmingham</city>
     <county>West Midlands (county)</county>
     <postcode>B72</postcode>
     <country>United Kingdom</country>
     <country_code>gb</country_code>
   </place>
 </searchresults>

反向地理编码/地址查询

反向地理编码由纬度和经度产生一个地址。可选的缩放参数指定用于显示某信息在openlayers上显示的合适的缩放级别。

参数

 http://nominatim.openstreetmap.org/reverse?<query>
 format=[xml|json]
   Output format
 json_callback=<string>
   Wrap json output in a callback function (JSONP) i.e. <string>(<json>) 
 accept-language=<browser language string>
   Preferred language order for showing search results, overrides the browser value.  
   Either uses standard rfc2616 accept-language string or a simple comma separated list of language codes.
 osm_type=[N|W|R]
 osm_id=<value>
   A specific osm node / way / relation to return an address for
   Please use this in preference to lat/lon where possible 
 lat=<value>
 lon=<value>
   The location to generate an address for
 zoom=[0-18]
   Level of detail required where 0 is country and 18 is house/building
 addressdetails=[0|1]
   Include a breakdown of the address into elements
 email=<valid email address>
   If you are making large numbers of request please include a valid email address
   or alternatively include your email address as part of the User-Agent string.
   This information will be kept confidential and only used to contact you in the
   event of a problem, see Usage Policy for more details.

示例

 http://nominatim.openstreetmap.org/reverse?format=xml&lat=52.5487429714954&lon=-1.81602098644987&zoom=18&addressdetails=1
 <reversegeocode timestamp="Fri, 06 Nov 09 16:33:54 +0000" querystring="...">
   <result place_id="1620612" osm_type="node" osm_id="452010817">
     135, Pilkington Avenue, Wylde Green, City of Birmingham, West Midlands (county), B72, United Kingdom
   </result>
   <addressparts>
     <house>135</house>
     <road>Pilkington Avenue</road>
     <village>Wylde Green</village>
     <town>Sutton Coldfield</town>
     <city>City of Birmingham</city>
     <county>West Midlands (county)</county>
     <postcode>B72</postcode>
     <country>United Kingdom</country>
     <country_code>gb</country_code>
   </addressparts>   
 </reversegeocode>

详情/地名

详细信息页面(details.php)会上产生很高的服务器负载,而且仅作为调试之用途,因此目前没有提供XML API。写入脚本或大量的使用可能会导致IP禁令。

使用政策

关于nominatim.openstreetmap.org的使用政策,请查看Nominatim使用政策

Mapquest 也提供了一个版本的API,没有使用限制。详情请参阅[1]

源代码

Nominatim是基于PostgreSQL的导入实用程序osm2pgsql使用替代地名输出选项。索引和搜索是使用的C,PLPGSQL和PHP相结合进行。源可以在这里找到:

http://github.com/twain47/Nominatim

完整的安装说明可以在Nominatim/Installation中找到。.

Bug/错误报告

Nominatim由Twain维护,请使用Nominatim组件Trac报告错误。