Skip to content

PHP Class to stitch map tiles from a map tile server together to one big image.

License

Notifications You must be signed in to change notification settings

netas-ch/map-tile-stitching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Map Tile Stitching

This small PHP library takes coordinates in WGS 84 (lat/lon) format and generates a image with the provided coordinates centered in the middle of the image. It loads the tiles from a provided tile server like ESRI, Google Earth, Swisstopo, etc...

usage

  1. define your map tile provider and create a instance:
// Swisstopo Map Tile Provider
$url = 'https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/current/3857/{z}/{x}/{y}.jpeg';
$copyright = '(c) ' . date('Y') . ' swisstopo.ch';
$zoom = 20;

// create a instance
$mapTileStitching = new netas\lib\maptilestitching\MapTileStitching($url, $copyright);
  1. create a image centered at lat/lon with the size 1920x1080:
$image = $mapTileStitching->createImage(46.81874, 7.58231, 1920, 1080, $zoom);
  1. output the image to the browser
header("Content-Type: image/jpeg");
imagejpeg($image);
imagedestroy($image);
  1. or save it as a file
imagejpeg($image, 'map.jpg');
imagedestroy($image);

About

PHP Class to stitch map tiles from a map tile server together to one big image.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages