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>

4 Comments to “ PHP MapTiler, Simple Map Tiles Generator ”

  1. Davis says:

    Hi,
    Can we implement maptiler using GD library rather than Imagemagic

  2. Carlos Guerra says:

    I tried but works well with zoom up to 4…I need at least 6 . Can you help me?

    Thanks

    • Fedik says:

      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

Leave a Reply to Davis Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>