kayw-geek/map-tiles

此包提供地图纬度和经度到瓦片坐标的转换,纬度和经度范围的计算,瓦片坐标范围的转换,通过纬度和经度下载指定范围内的地图瓦片图像(图像资源来自openstreetmap)

安装: 0

依赖: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 0

开放问题: 0

类型:composer-plugin

V1.0.0 2021-06-28 06:08 UTC

This package is auto-updated.

Last update: 2024-09-28 13:01:51 UTC


README

👍此包提供地图纬度和经度转换到瓦片坐标,计算纬度和经度范围,瓦片坐标范围转换,通过纬度和经度下载指定范围内的地图瓦片图像(图像资源来自openstreetmap)

GitHub Packagist Downloads GitHub top language

应用场景

可用于将地图纬度和经度转换为瓦片坐标,开发离线地图,使用Open Street Map地图数据等。

安装

$ composer require kayw-geek/map-tiles -vvv

用法

特性

KaywGeek\Map\MapTraits

use KaywGeek\Map;

class Map
{
    use MapTraits;
    
    <...>
}

API

//Returns 2 pairs of latitude and longitude from a given latitude and longitude calculation range
$m = new Map();
$m->rangeValue  = 0.5;
$range = $m->computeRangeByLonLat(116.4074,39.9042);

//Longitude and latitude are converted to tile coordinates
$m->lonLat2Tile(116.4074,39.9042,11);

//Get the path of the Open Strrt Map tile resource image by tile coordinates and zoom
$m->getTileImgPath([1686,776],11);

//Get image name by tile coordinates and zoom
$m->getImgName([1686,776],11);

//Download file to local
$m->download('https://tile.openstreetmap.org/11/1686/776.png','./data/11_1686_776.png');

//Get the full tile image path of OpenStreetMap with the latitude and longitude range value zoom level
$m->getAllImgPath(['116.20740','39.70420','116.60740','40.10420'],10);

许可

MIT