定制 francescotrucchia/geo-adapter 二次开发

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

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

francescotrucchia/geo-adapter

Composer 安装命令:

composer require francescotrucchia/geo-adapter

包简介

Library to use different geolocalization adapter

README 文档

README

With GeoAdapter you can find a location from an address. A location is a object with latitude and longitude attribute. Location object implements a method can calculate distance between two location.

<?php

require_once __DIR__ . '/../vendor/autoload.php';

$search = new Geo\Search();
$search->addService(new Geo\Service\OpenStreetMap\Nominatim());

$search->query('Milano');
$location_a = $search->getFirst();

$search->query('Firenze');
$location_b = $search->getFirst();

echo 'Address1: via Montenapoleone, Milano'.PHP_EOL;
echo 'Latitude: '.$location_a->getLatitude().PHP_EOL;
echo 'Longitude: '.$location_a->getLongitude().PHP_EOL.PHP_EOL;

echo 'Address2: piazza Boccolino, Osimo'.PHP_EOL;
echo 'Latitude: '.$location_b->getLatitude().PHP_EOL;
echo 'Longitude: '.$location_b->getLongitude().PHP_EOL.PHP_EOL;

$distance = $location_a->distance($location_b);

echo "Distance from Milano to Firenze is $distance Km".PHP_EOL;

This software is released under GPL license.

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: GPL
  • 更新时间: 2022-05-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固