geocoder-php/arcgis-online-provider

Geocoder ArcGIS Online 适配器

4.4.0 2022-07-30 12:09 UTC

This package is auto-updated.

Last update: 2024-09-04 10:58:50 UTC


README

Build Status Latest Stable Version Total Downloads Monthly Downloads Code Coverage Quality Score Software License

这是 PHP Geocoder 的 ArcGIS 提供程序。这是一个只读仓库。有关信息和文档,请参阅主仓库

ArcGIS 提供了 2 个地址地理编码 API

  • geocodeAddresses
  • findAddressCandidates
    • 该 API 说明

    应用程序在合同上被禁止存储地理编码交易的成果,除非它们通过传递值为 trueforStorage 参数和有效的 ArcGIS Online token 参数来请求。

由于 geocodeAddresses API 需要令牌,因此 geocodeQuery 方法检查 token 属性

  • 如果 tokenNULL,则使用 findAddressCandidates API。
  • 如果 token 不是 NULL,则使用 geocodeAddresses API。

用法

无令牌

$httpClient = new \Http\Discovery\Psr18Client();

$provider = new \Geocoder\Provider\ArcGISList\ArcGISList($httpClient);

// Uses the `findAddressCandidates` operation. Result storage is prohibited.
$result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));

有令牌

$httpClient = new \Http\Discovery\Psr18Client();

// Your token is required.
$provider = \Geocoder\Provider\ArcGISList\ArcGISList::token($httpClient, 'your-token');

// Uses the `geocodeAddresses` operation. Result storage is permitted.
$result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));

安装

composer require geocoder-php/arcgis-online-provider

注意

可以指定一个 sourceCountry 来限制结果只针对这个特定的国家,从而减少请求时间(请注意,这不适用于反向地理编码)。

贡献

欢迎贡献!请向主仓库发送拉取请求,或在任何问题跟踪器上报告您发现的任何问题。