{"id":27235275,"url":"https://github.com/ministryofweb/php-osm-tiles","last_synced_at":"2025-04-10T16:38:40.536Z","repository":{"id":62529392,"uuid":"119530510","full_name":"ministryofweb/php-osm-tiles","owner":"ministryofweb","description":"A library which converts geographical coordinates to map tile numbers","archived":false,"fork":false,"pushed_at":"2023-12-04T14:15:10.000Z","size":30,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-07T09:13:58.556Z","etag":null,"topics":["conversion","coordinates","openstreetmap","osm","tiles"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ministryofweb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-30T12:07:09.000Z","updated_at":"2023-07-27T20:14:55.000Z","dependencies_parsed_at":"2022-11-02T14:30:32.182Z","dependency_job_id":null,"html_url":"https://github.com/ministryofweb/php-osm-tiles","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofweb%2Fphp-osm-tiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofweb%2Fphp-osm-tiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofweb%2Fphp-osm-tiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofweb%2Fphp-osm-tiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ministryofweb","download_url":"https://codeload.github.com/ministryofweb/php-osm-tiles/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055250,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conversion","coordinates","openstreetmap","osm","tiles"],"created_at":"2025-04-10T16:38:39.965Z","updated_at":"2025-04-10T16:38:40.521Z","avatar_url":"https://github.com/ministryofweb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP OSM Tiles\n\nThis library helps to convert OpenStreetMap (OSM) map tile numbers to\ngeographical coordinates and vice versa.\n\n[![PHP OSM Tiles Tests](https://github.com/ministryofweb/php-osm-tiles/actions/workflows/php.yml/badge.svg)](https://github.com/ministryofweb/php-osm-tiles/actions/workflows/php.yml)\n\n## Installation\n\nUsing Composer, just add it to your `composer.json` by running:\n\n```shell\ncomposer require ministryofweb/php-osm-tiles\n```\n\n## Compatibility\n\nThe PHP OSM Tiles library requires PHP \u003e= 8.1.\n\nIf support for older PHP versions is needed, the PHP OSM Tiles library can be installed at version 2.0 (PHP 7.3, PHP 7.4 and PHP 8.0), 1.0 (PHP 7.1 and PHP 7.2) or version 0.1.0 (PHP 7.0).\n\n## Usage/Examples\n\n## Convert from geographical coordinates to map tile numbers\n\n```php\n\u003c?php\n\nuse MinistryOfWeb\\OsmTiles\\Converter;\nuse MinistryOfWeb\\OsmTiles\\LatLng;\n\n$converter = new Converter();\n$point     = new LatLng(52.5, 13.4);\n$zoom      = 13;\n\n$tile = $converter-\u003etoTile($point, $zoom);\n\nprintf('/tiles/%d/%d/%d.png', $zoom, $tile-\u003ex, $tile-\u003ey);\n```\n\nThe code above produces the output below:\n\n```text\n/tiles/13/4400/2687.png\n```\n\n## Convert from map tile numbers to geographical coordinates\n\n```php\n\u003c?php\n\nuse MinistryOfWeb\\OsmTiles\\Converter;\nuse MinistryOfWeb\\OsmTiles\\Tile;\n\n$converter = new Converter();\n$tile     = new Tile(4400, 2687, 13);\n\n$point = $converter-\u003etoLatLng($tile);\n\nprintf('%.5f, %.5f', $point-\u003elat, $point-\u003elat);\n```\n\nThe code above produces the output below:\n\n```text\n52.50953, 13.35938\n```\n\n## Get Bounds of a Tile\n\nIt's possible to get the coordinates for the Tiles north-western, north-eastern, south-eastern and south-western nodes:\n\n```php\n\u003c?php\n\nuse MinistryOfWeb\\OsmTiles\\LatLng;\nuse MinistryOfWeb\\OsmTiles\\Tile;\nuse MinistryOfWeb\\OsmTiles\\TileBounds;\n\n$tile = Tile::fromLocation(new LatLng(52.5, 13.5));\n\necho 'South-eastern point for tile is located at: ' . TileBounds::getSouthEast($tile)-\u003elat . ', ' . TileBounds::getSouthEast($tile)-\u003elng . PHP_EOL;\n```\n\nThe code above produces the output below:\n\n```\nSouth-eastern point for tile is located at: 52.496159531097, 13.51318359375\n```\n\n## Run Tests\n\n``` shell script\nmake test\n```\n\nor\n\n``` shell script\n./vendor/bin/phpunit\n```\n\n## Run all CI tools\n\n``` shell script\nmake ci\n```\n\n## OpenStreetMap Map Tile Names Documentation\n\n- https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fministryofweb%2Fphp-osm-tiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fministryofweb%2Fphp-osm-tiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fministryofweb%2Fphp-osm-tiles/lists"}