定制 mehrdad-dadkhah/open-street-map-api 二次开发

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

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

mehrdad-dadkhah/open-street-map-api

Composer 安装命令:

composer require mehrdad-dadkhah/open-street-map-api

包简介

Open Street Map (OSM) service to call and get results of APIs

README 文档

README

Packagist Version

Open Street Map (OSM) service to call and get results of APIs.

Will add new services in future.

System requirements

only with >=7.0.0

Installation

composer require mehrdad-dadkhah/open-street-map-api

Usage

with coordinates option:

use MehrdadDadkhah\OSM\OSMRouteService;

$osm = new OSMRouteService;
        $osm->addCoordinate(35.6998, 51.3310)
            ->addCoordinate(35.7581, 51.5087);
        
        echo $osm->getDuration()->getWithUnit(\MehrdadDadkhah\OSM\Types\Duration::MINUTE_UNIT); // or 'minute'
        echo $osm->getDistance()->getWithUnit(\MehrdadDadkhah\OSM\Types\Distance::KILOMETER_UNIT); // or 'kilometer'

with polyline option:

use MehrdadDadkhah\OSM\OSMRouteService;

$osm = new OSMRouteService;
        $osm->setPolyline('ofp_Ik_vpAilAyu@te@g%60E');
        
        echo $osm->getDuration()->getWithUnit(\MehrdadDadkhah\OSM\Types\Duration::MINUTE_UNIT);
        echo $osm->getDistance()->getWithUnit(\MehrdadDadkhah\OSM\Types\Distance::KILOMETER_UNIT);

If you have local osm-backend server, you can change base url by:

        $osm->setBaseUrl('http://your-url.local');

Reverse location with osm

$result = $locationService->setBaseUrl('CAN-SET-URL') // it's optional
        ->setPoint($lat, $long)
        ->setLanguage('fa')
        ->reverseLocation();

Geocodeing

        use use MehrdadDadkhah\OSM\NominatimSearchPlaceService;
        .
        .
        .
        $nomiLocationService = new NominatimSearchPlaceService();
        $nomiLocationService->setLimit(1)
            ->enableAddressDetails()
            ->setSearchQuery($city->name) // name of city
            ->search();

Self hosted

If you want self host osrm-backend and notinimate can copy and custom docker-compose.yml in docker directory.

Acknowledgments

Uses:

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-01-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固