iseed838/photon-api

Photon-api 包装器项目

0.1.4 2021-06-08 06:15 UTC

This package is auto-updated.

Last update: 2024-09-08 12:47:25 UTC


README

Photon-api 包装器项目

为 photon 项目(https://photon.komoot.de/)请求的包装器 https://photon.komoot.de/

允许您通过文本模板进行完全上下文搜索,以及通过坐标进行反向搜索

  • 使用 composer 安装,请尝试

composer require iseed838/photon-api "~0.1"

  • 进行查询请求
$client   = new \Photon\Models\PhotonClient(new \GuzzleHttp\Client());

$request  = new \Photon\Models\PhotonQueryRequest([
    'query'  => "Moscow Valilova 6",
]);
$response = $client->query($request);
  • 进行反向请求
$client   = new \Photon\Models\PhotonClient(new \GuzzleHttp\Client());

$request  = new \Photon\Models\PhotonReverseRequest( [
    'latitude'  => 55.630358,
    'longitude' => 37.516776,
]);
$response = $client->reverse($request);

结果返回一个包含响应对象限制的数组

    [0] => Photon\Models\PhotonResponse Object
        (
            [osm_id] => 537247988
            [osm_type] => W
            [extent] => Array
                (
                    [0] => 37.516021
                    [1] => 55.6309387
                    [2] => 37.5177537
                    [3] => 55.6299123
                )

            [osm_key] => building
            [osm_value] => retail
            [postcode] => 117632
            [countrycode] =>
            [country] => Russia
            [state] => Moscow
            [city] => Konkovo District
            [street] => Profsous street
            [housenumber] => 126 c3
            [latitude] => 55.63039825
            [longitude] => 37.516796697274
            [type] => Point
        )

查询请求属性

  • query (string|required) 文本查询
  • longitude (int|float|null) 额外框坐标
  • latitude (int|float|null) 额外框坐标
  • language (required|string) 响应语言。默认为 en。可接受 en,de,ft,it
  • limit (required|int) 响应计数/默认为 5
  • osm_tag (string|null) 对 osm_tag 的额外过滤

反向请求属性

  • longitude (required|int|float) 地址坐标
  • latitude (required|int|float) 地址坐标
  • language (required|string) 响应语言。默认为 en。可接受 en,de,ft,it
  • limit (required|int) 响应计数/默认为 5