GithubHelp home page GithubHelp logo

qqmap-region's Introduction

qqmap-region

腾讯位置服务**标准行政区划数据 SDK.

StyleCI

安装

$ composer require tumobi/qqmap-region -vvv

配置

创建 key

在使用本扩展之前,你需要去 腾讯位置服务 注册账号,在 key管理 中创建新密钥。

开启 WebServiceAPI

找到刚新创建的 key ,点击 设置 按钮进入 KEY 设置页面,勾选 WebServiceAPI 后保存。

使用

use Tumobi\QQMapRegion\Region;

$key = '你创建的 key';
$region = new Region($key);

获取全部行政区划数据

$result = $region->getAllDistrict();
print_r($result);

获取子级行政区划

// 北京市
$region_id = 110000;
$result = $region->getChildrenDistrict($region_id);
print_r($result);

搜索指定关键词的行政区划

$keyword = '香格里拉';
$result = $region->searchDistrict($keyword);
print_r($result);

在 Laravel 中使用

安装方式同上,需要添加两处配置,在 config/services.php 加入如下配置

'region' => [
    'key' => env('REGION_KEY'),
],

在 .env 文件中加入如下配置

REGION_KEY=在腾讯位置服务创建的key

使用方法

public function edit(Region $region) 
{
    $districts = $region->getAllDistrict();
}

public function edit() 
{
    $districts = app('region')->getAllDistrict();
}

参考

License

MIT

qqmap-region's People

Contributors

tumobi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.