Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am newbie in PHP. I am using tileserver.php to serve my *.mbtiles as web map. I have configure it and when I am trying to access the localhost it replying like following enter image description here

Now please help me to visualize the available map in browser. What should I do to visualize the map in browser?

I have tried the following codes with OpenLayers

    <html>
<head>
  <title>OpenLayers Example</title>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    </head>
    <body>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">
        var map = new OpenLayers.Map('map');
        var TMS = new OpenLayers.Layer.TMS( "MBTiles Overlay",
            "http://localhost:8080/tileserver/DHK_17/", {layers: 'basic'} );
        map.addLayer(TMS);
        map.zoomToMaxExtent();
    map.setCenter(new OpenLayers.LonLat(23.81, 90.40),17);
      </script>
</body>
</html>
share|improve this question

2 Answers 2

up vote 3 down vote accepted

This is just a tile server, its purpose is just to serve tiles. You will need a mapping application to access the tiles, something like OpenLayers, Google Maps, LeafletJS. You then tell your mapping API to use tileserver.php to get tiles at the address described in the documentation at github. Github Readme

You should never have to directly access tileserver.php.

Though, nice project, never seen it before. Probably will have to come up with a project to use it...

Because of your earlier question: Creating Tile server without using any Base Map. My answer needs to be clarified.

Using something like OpenLayers or Leaflet you don't have to use OSM's or Cloudmade's tile service. These applications just provide the framework for developing map applications. You don't have to use any tile service if want (thought it could be hard to read); you could create custom tiles for Middle Earth and use them. There isn't a 'lock-in' on these mapping applications, you can do what you will with them.

In-fact reading from what are asking in these two questions I either don't understand your question or you don't understand the difference between the two systems. Think of it as layers built upon on another.

First you have the tile service, this is the 'map' as most people think of the, tile servers provide tiles that have streets, lakes, parks, etc on them. If you asked the tile servers for their tiles without a mapping application it would just hand you back a bunch of unorganized tiles that wouldn't help you much.

This is where a mapping application like Google Maps, Open Layers, and Leaflet come in. They take all those jumbled tiles, arrange them, stitch them together, and give your controls so you can zoom and pan. All three of these mapping APIs do provide a tile service so you don't HAVE to go looking for tile service, but they do not restrict you from doing so.

As I said, you can create your own tiles, your own 'map', and serve it with tileserver.php. This can be anything you want it to be. In fact you can see this here which uses Google Maps API but is used for creating a 'slippy-map' of World of Warcraft's fantasy-land, Azeroth. ...And yes I do play...

share|improve this answer
    
Thanks a lot RomaH for a clear concept. But my main issue is not using any others map. I have some restriction of my own. Such as some services charges fee. Some other do not cover my country in a micro scale. So I want to use my tiles. Now probably you are thinking what will be the issue with osm. I do not want to load osm layer then my tiles layer it will slow down the system. Can you say how could I resolve it or is there any way/tools to creat mapping application? –  Devils Dream Nov 27 '12 at 3:33
    
You don't have to load the OSM tiles on any mapping application. There is a specific line of code that you have to insert to tell the applications to load tiles from a certain web address. If you don't tell it to load OSM tiles, it won't. Instead you would just have a white map. Instead what you would want to do is host your own tiles and insert your web address instead of OSM's. OSM's servers are never even spoken to or considered during your map deployment. –  RomaH Nov 27 '12 at 13:40
    
You are wanting to reinvent the wheel. If you think you can do better and make a mapping application that fits you needs or provides something that the other do not, go right ahead it would be great really. But it is not a small technical challenge. LeafletJS and OpenLayers are just frameworks, a skeleton, they provide controls and means to organize the tiles. It is your job to fill out the rest. It is your job to add features, supply the tiles, supply the overlays. –  RomaH Nov 27 '12 at 13:54
    
Thanks again RomaH. Can you tell me where I get the instruction to write the code and which platform you prefer most, leaflet or OSM? I have to do a R&D with it. If successful then I will go for full project. –  Devils Dream Nov 28 '12 at 10:08
    
As you see the tile server is working. Now how I could visualize this on web? I tried leafletjs but I failed. What should I do? –  Devils Dream Nov 29 '12 at 17:25

Just try the mentioned TileServer.php project, which we just released:

https://github.com/klokantech/tileserver-php/

Now it is easier to install and it comes with sample map viewers (Leaflet, OpenLayers, OL3, Google Maps API, etc) presenting a ready to use JavaScript source code.

The server supports also OGC WMTS - so the maps can be opened in QGIS or ArcGIS for Desktop.

Here is a live demo: http://tileserver.maptiler.com/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.