Chr*_*iso 6 geocoding openlayers-3
我有一个 PHP 项目,我正在使用 openlayers 制作地图,但我需要通过传递地址列表来定位书签,它必须是一个免费的地理编码器,因为有很多地址。非常感谢。
要免费对您的地点地址进行地理编码,请使用 nominatim.openstreetmap.org 地理编码器和 jquery ajax,如下所示:
\n\nvar data = {\n "format": "json",\n "addressdetails": 1,\n "q": "22 rue mouneyra bordeaux",\n "limit": 1\n};\n$.ajax({\n method: "GET",\n url: "https://nominatim.openstreetmap.org",\n data: data\n})\n.done(function( msg ) {\n console.log( msg );\n});\nRun Code Online (Sandbox Code Playgroud)\n\n您将收到一个美味的 json 对象:
\n\naddress: {\n city: "Bordeaux"\n country: "France"\n country_code: "fr"\n county: "Bordeaux"\n house_number: "22"\n postcode: "33000"\n road: "Rue Mouneyra"\n state: "Nouvelle-Aquitaine"\n suburb: "Saint-Augustin - Tauzin - Alphonse Dupeux"\n}\nboundingbox:["44.8341251", "44.8342251", "-0.581869", "-0.581769"]\nclass: "place"\ndisplay_name: "22, Rue Mouneyra, Saint-Augustin - Tauzin - Alphonse Dupeux, Bordeaux, Gironde, Nouvelle-Aquitaine, France m\xc3\xa9tropolitaine, 33000, France"\nimportance: 0.411\nlat: "44.8341751"\nlicence: "Data \xc2\xa9 OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright"\nlon: "-0.581819"\nosm_id: "2542169758"\nosm_type: "node"\nplace_id: "26453710"\ntype: "house"\nRun Code Online (Sandbox Code Playgroud)\n\n然后,您可以循环对多个地点进行地理编码。
\n\n干杯
\n