PHPackages                             kayw-geek/map-tiles - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kayw-geek/map-tiles

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

kayw-geek/map-tiles
===================

This package provides map latitude and longitude conversion to tile coordinates, calculation of the latitude and longitude range, conversion of the tile coordinate range, downloading the map tile image within the specified range through the latitude and longitude (image resources from openstreetmap)

V1.0.0(5y ago)00MITPHPPHP &gt;=7.1

Since Jun 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kayw-geek/map-tiles)[ Packagist](https://packagist.org/packages/kayw-geek/map-tiles)[ Docs](https://github.com/overtrue/pinyin)[ RSS](/packages/kayw-geek-map-tiles/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

map-tiles
=========

[](#map-tiles)

---

👍This package provides map latitude and longitude conversion to tile coordinates, calculation of the latitude and longitude range, conversion of the tile coordinate range, downloading the map tile image within the specified range through the latitude and longitude (image resources from openstreetmap)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#this-package-provides-map-latitude-and-longitude-conversion-to-tile-coordinates-calculation-of-the-latitude-and-longitude-range-conversion-of-the-tile-coordinate-range-downloading-the-map-tile-image-within-the-specified-range-through-the-latitude-and-longitude-image-resources-from-openstreetmap)

[![GitHub](https://camo.githubusercontent.com/4c53c589891b279cabb6517184ddeb0154c25ce4395dd7e6171383e268cc1a1f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6b6179772d6765656b2f6d61702d74696c6573)](https://camo.githubusercontent.com/4c53c589891b279cabb6517184ddeb0154c25ce4395dd7e6171383e268cc1a1f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6b6179772d6765656b2f6d61702d74696c6573)[![Packagist Downloads](https://camo.githubusercontent.com/5c9c23e90e9e6d3f14183dc58dae6ab2870d4231bdc4c3d833156aa4d5dcbada/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6b6179772d6765656b2f6d61702d74696c6573)](https://camo.githubusercontent.com/5c9c23e90e9e6d3f14183dc58dae6ab2870d4231bdc4c3d833156aa4d5dcbada/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6b6179772d6765656b2f6d61702d74696c6573)[![GitHub top language](https://camo.githubusercontent.com/91be8fc7472ccaaadc2806a96bd2c621f51154c930c3ef8fc192167ab22b2393/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f6b6179772d6765656b2f6d61702d74696c6573)](https://camo.githubusercontent.com/91be8fc7472ccaaadc2806a96bd2c621f51154c930c3ef8fc192167ab22b2393/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f6b6179772d6765656b2f6d61702d74696c6573)

Application scenario
--------------------

[](#application-scenario)

Can be used to convert map latitude and longitude into tile coordinates, develop offline maps, use Open Street Map map data, etc.

Installing
----------

[](#installing)

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

Usage
-----

[](#usage)

### Traits

[](#traits)

#### `KaywGeek\Map\MapTraits`

[](#kaywgeekmapmaptraits)

```
use KaywGeek\Map;

class Map
{
    use MapTraits;

}
```

### API

[](#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);
```

License
-------

[](#license)

MIT

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1831d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f40052c6a2120cfd79e19ee61cc32aaf43252072be9d85caa6b25c83506eda19?d=identicon)[weikaiii](/maintainers/weikaiii)

---

Top Contributors

[![kayw-geek](https://avatars.githubusercontent.com/u/29700073?v=4)](https://github.com/kayw-geek "kayw-geek (4 commits)")

---

Tags

latitude-and-longitudeoffline-mapsopenstreetmaptilesmaplatitudelongitudetilesOpenStreetMap

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kayw-geek-map-tiles/health.svg)

```
[![Health](https://phpackages.com/badges/kayw-geek-map-tiles/health.svg)](https://phpackages.com/packages/kayw-geek-map-tiles)
```

###  Alternatives

[php-coord/php-coord

PHPCoord is a PHP library to aid in handling coordinates. It can convert coordinates for a point from one system to another and also calculate distance between points.

109996.7k12](/packages/php-coord-php-coord)[anthonymartin/geo-location

Powerful GeoCoding library: Retrieve bounding box coordinates, distances between geopoints, point in polygon, get longitude and latitude from addresses and more with GeoLocation for PHP

1961.0M11](/packages/anthonymartin-geo-location)[kenguest/services-openstreetmap

More information available at https://pear.php.net/package/Services\_OpenStreetMap

20341.5k](/packages/kenguest-services-openstreetmap)[data-values/geo

Geographical value objects, parsers and formatters

20654.5k22](/packages/data-values-geo)[laravie/geotools

Geo-related tools PHP 7+ library

18136.3k1](/packages/laravie-geotools)[mcguffin/acf-openstreetmap-field

WordPress ACF Field for OpenStreetMap

1093.8k](/packages/mcguffin-acf-openstreetmap-field)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
