matasarei / osm-client
该软件包最新版本(dev-master)没有可用的许可证信息。
dev-master
2020-01-02 10:20 UTC
Requires
- php: >=7.0
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^6
This package is not auto-updated.
Last update: 2024-09-21 06:59:36 UTC
README
OSM服务的非官方客户端
限制
默认情况下,客户端使用官方搜索端点 https://nominatim.openstreetmap.org/search.php
,仅限开发或调试目的使用!
如果您打算经常使用或用于商业用途,您必须 设置 您自己的Nominatim服务或使用第三方服务提供商。
$client = new \OsmClient\OsmClient(); $client->setSearchEndpoint('https://nominatim.3rd-party.server/search.php');
更多信息请参阅 Nominatim使用政策。
使用示例
$client = new \OsmClient\OsmClient(); $client->setCountryIso('UA'); $result = $client->findOne('Kyiv, Independence Square'); var_dump($result);
输出
array(12) {
["place_id"]=>
int(252253866)
["licence"]=>
string(71) "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright"
["osm_type"]=>
string(8) "relation"
["osm_id"]=>
int(9287875)
["boundingbox"]=>
array(4) {
[0]=>
string(10) "50.4487372"
[1]=>
string(10) "50.4516909"
[2]=>
string(10) "30.5216409"
[3]=>
string(10) "30.5270455"
}
["lat"]=>
string(11) "50.45016285"
["lon"]=>
string(16) "30.5241869112747"
["display_name"]=>
string(176) "Майдан Незалежності, Хрещатик вулиця, Бегічевська Гора, Клов, Печерський район, Київ, 1001, Україна"
["class"]=>
string(5) "place"
["type"]=>
string(6) "square"
["importance"]=>
float(0.468492664476)
["address"]=>
array(9) {
["address29"]=>
string(37) "Майдан Незалежності"
["road"]=>
string(29) "Хрещатик вулиця"
["neighbourhood"]=>
string(31) "Бегічевська Гора"
["suburb"]=>
string(8) "Клов"
["county"]=>
string(31) "Печерський район"
["city"]=>
string(8) "Київ"
["postcode"]=>
string(4) "1001"
["country"]=>
string(14) "Україна"
["country_code"]=>
string(2) "ua"
}
}