Here is a simple way to create your own map, based on you image ;)
PHP MapTiler class allow to prepare the image with PHP, to use it in the own map. It splits the main image in to the standard tiles.
Download here PHP MapTiler
Example make custom map:
Generate the Tiles:
//init $map_tiler = new MapTiler('/full/path/to/my-image.jpg', array( 'tiles_path' => '/full/path/to/where-store-result/' 'zoom_max' => 3, )); //execute try { $map_tiler->process(true); } catch (Exception $e) { echo $e->getMessage(); echo $e->getTraceAsString(); } |
Display the result with Leaflet.js:
<html> <head> <link rel="stylesheet" href="dist/leaflet.css" /> </head> <body> <div id="map" style="width: 700px; height: 500px;"></div> <script src="dist/leaflet.js"></script> <script> var tiles = L.tileLayer('tiles-path/{z}/{x}/{y}.jpg', { minZoom: 0, maxZoom: 3, tms: true }); var map = L.map('map', { center: [0, 0], zoom:1, minZoom: 0, maxZoom: 3, //crs: L.CRS.Simple, //available in dev version layers:[tiles] }); </script> </body> </html> |
Hi,
Can we implement maptiler using GD library rather than Imagemagic
yes, if your server have a 100000000TB memory ;)
otherwise with GD you will get the memory usage problem
I tried but works well with zoom up to 4…I need at least 6 . Can you help me?
Thanks
It because your original image smaller than it need for lvl 6.
You need to set param
'scaling_up' => 6
to force image resize up to 6 lvl