geocoder-php/mapquest-provider 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

geocoder-php/mapquest-provider

Composer 安装命令:

composer require geocoder-php/mapquest-provider

包简介

Geocoder MapQuest adapter

README 文档

README

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

This is the MapQuest provider from the PHP Geocoder. This is a READ ONLY repository. See the main repo for information and documentation.

Install

composer require geocoder-php/mapquest-provider

Geocode with more exact addresses

The MapQuest Provider allows you to create and pass geocode queries based on a full Address object of class Geocoder\Model\Address or any other object that implements Geocoder\Location.

This will take advantage of what MapQuest calls the 5-box Input address format. Quote from MapQuest Developer: Specifying Locations:

The 5-Box Input address format (which is compatible with JSON and XML), allows for a higher degree of address specification by entering the full address in its individual location parameters. The 5-Box Input format is beneficial as it bypasses the parsing functionality of the single-line request.

If you have an object of a class that implements Geocoder\Location stored in the variable $address, this new type of GeocodeQuery can be created with:

$query = GeocodeQuery::create('foobar');
$query = $query->withData(MapQuest::DATA_KEY_ADDRESS, $address);

If you want the GeocodeQuery to also work fine with all the other providers, you will need to convert the $address object to a text string first. Say you have stored this text string in the variable $addressAsString, the the example will read as follows:

$query = GeocodeQuery::create($addressAsString);
$query = $query->withData(MapQuest::DATA_KEY_ADDRESS, $address);

Here is a more complete example with use statements, and building of the address object:

Example

use Geocoder\Model\AddressBuilder;
use Geocoder\Provider\MapQuest\MapQuest;
use Geocoder\Query\GeocodeQuery;

$provider = new MapQuest($httpClient, $apiKey);

$addressBuilder = new AddressBuilder('Address provided by me');
$addressBuilder
  ->setStreetNumber(4868)
  ->setStreetName('Payne Rd');
  ->setLocality('Nashville');
  ->setSubLocality('Antioch');
  ->setAdminLevels([
      new AdminLevel(1, 'Tennessee', 'TN')
  ])
  ->setPostalCode('37013');
  ->setCountry('USA');
  ->setCountryCode('US');
$address = $addressBuilder->build();

$query = GeocodeQuery::create('dummy data');
$query = $query->withData(MapQuest::DATA_KEY_ADDRESS, $address);

$results = $provider->geocodeQuery($query);

Contribute

Contributions are very welcome! Send a pull request to the main repository or report any issues you find on the issue tracker.

geocoder-php/mapquest-provider 适用场景与选型建议

geocoder-php/mapquest-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 287.29k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 287.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 21
  • 依赖项目数: 2
  • 推荐数: 1

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-03