madebydaniz/location-info

这是一个通过名称和地址搜索OSM数据,并生成OSM点合成地址的工具(反向地理编码)。

1.0.1 2020-05-01 20:30 UTC

This package is auto-updated.

Last update: 2024-09-28 21:10:54 UTC


README

Latest Stable Version Total Downloads License

这是一个通过名称和地址搜索OSM数据,并生成OSM点合成地址的工具(反向地理编码)。

要求

安装

通过Composer安装

$ composer require madebydaniz/location-info

用法

参考:https://nominatim.org/release-docs/develop/api/Search/

$address = "Stephansplatz 2, 1010, Wien";
$data = LocationInfo::getInstance()::search($address);
print_r($data);

#output
Array
(
    [place_id] => 4868677
    [licence] => Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright
    [osm_type] => node
    [osm_id] => 567056993
    [boundingbox] => Array
        (
            [0] => 48.2080963
            [1] => 48.2081963
            [2] => 16.3722742
            [3] => 16.3723742
        )

    [lat] => 48.2081463
    [lon] => 16.3723242
    [display_name] => 2, Stephansplatz, Stubenviertel, KG Innere Stadt, Innere Stadt, Wien, 1010, Österreich
    [class] => place
    [type] => house
    [importance] => 0.441
)

#TODO : 返回格式

  • html
  • xml
  • json
  • jsonv2
  • geojson
  • geocodejson