定制 swisnl/geocoder-php-nationaal-georegister-provider 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

swisnl/geocoder-php-nationaal-georegister-provider

Composer 安装命令:

composer require swisnl/geocoder-php-nationaal-georegister-provider

包简介

PDOK (formerly Nationaal Georegister) provider for Geocoder PHP

README 文档

README

PHP from Packagist Latest Version on Packagist Software License Buy us a tree Build Status Coverage Status Quality Score Total Downloads Made by SWIS

This is the PDOK (formerly Nationaal Georegister) provider for the PHP Geocoder, which uses the PDOK Locatieserver v3 (Dutch). It can geocode addresses (not IP addresses) and reverse geocode coordinates.

Please note that this provider can only (reverse) geocode addresses in The Netherlands!

Install

Via Composer

$ composer require swisnl/geocoder-php-nationaal-georegister-provider

HTTP Client

PHP Geocoder is decoupled from any HTTP messaging client with the help of PSR-18 HTTP Client. This requires another package providing psr/http-client-implementation. To use Guzzle 7, for example, simply require guzzlehttp/guzzle:

$ composer require guzzlehttp/guzzle

Usage

// Create geocoder
$client = new \GuzzleHttp\Client();
$geocoder = new \Swis\Geocoder\NationaalGeoregister\NationaalGeoregister($client);

// Geocode!
$query = \Geocoder\Query\GeocodeQuery::create(...);
$result = $geocoder->geocodeQuery($query);

Please see PHP Geocoder documentation for more information about using PHP Geocoder with this provider.

Options

This provider accepts extra options in the constructor, or as query data. These options are directly passed to the Locatieserver, which accepts the following options:

Option Description Default Customizable in this provider
bq Boost query "type:gemeente^0.5 type:woonplaats^0.5 type:weg^1.0 type:postcode^1.5 type:adres^1.5" yes
df Default field - yes
fl Field list All fields used by this provider no
fq Filter query - yes
lat&lon Latitude and longitude Coordinates from \Geocoder\Query\ReverseQuery when reverse geocoding only for geocoding
q Search term Text from \Geocoder\Query\GeocodeQuery when geocoding no
rows Amount of rows Limit from query no
start Page (starting at 0) - yes
sort Sorting See Locatieserver documentation (Dutch) yes
wt Format JSON no

These options correspond with the options mentioned in the Locatieserver documentation (Dutch), which describes them in more detail.

Example using extra options:

// On the geocoder instance:
$client = new \GuzzleHttp\Client();
$options = ['fq' => 'bron:BAG'];
$geocoder = new \Swis\Geocoder\NationaalGeoregister\NationaalGeoregister($client, $options);

// Or just once on the query:
$query = \Geocoder\Query\GeocodeQuery::create(...)->withData('fq', 'bron:BAG');

Response

The geocoder returns a \Geocoder\Model\AddressCollection which is a collection of \Geocoder\Model\Address.

Example response (first \Geocoder\Model\Address from collection) for query "3e Binnenvestgracht 23T1, Leiden" using this provider:

$address->getCoordinates() => \Geocoder\Model\Coordinates
$address->getLatitude() => 52.164203
$address->getLongitude() => 4.49202289
$address->getBounds() => null (unavailable)
$address->getStreetNumber() => '23T-1'
$address->getStreetName() => '3e Binnenvestgracht'
$address->getPostalCode() => '2312NR'
$address->getLocality() => 'Leiden'
$address->getSubLocality() => null (unavailable)
$address->getAdminLevels()->get(2)->getName() => 'Leiden'
$address->getAdminLevels()->get(2)->getCode() => '0546'
$address->getAdminLevels()->get(1)->getName() => 'Zuid-Holland'
$address->getAdminLevels()->get(1)->getCode() => 'PV28'
$address->getCountry() => 'Netherlands' (static)
$address->getCountryCode() => 'NL' (static)
$address->getTimezone() => 'Europe/Amsterdam' (static)

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email security@swis.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

SWIS ❤️ Open Source

SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.

swisnl/geocoder-php-nationaal-georegister-provider 适用场景与选型建议

swisnl/geocoder-php-nationaal-georegister-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 349.69k 次下载、GitHub Stars 达 28, 最近一次更新时间为 2018 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「geocoder」 「provider」 「swisnl」 「swis」 「nationaal-georegister」 「ngr」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 swisnl/geocoder-php-nationaal-georegister-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 swisnl/geocoder-php-nationaal-georegister-provider 我们能提供哪些服务?
定制开发 / 二次开发

基于 swisnl/geocoder-php-nationaal-georegister-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 349.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 28
  • 点击次数: 12
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 28
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-07