3

for few days i have been working on developing my own osm tile server. I tried it on linux as well as on windows, no complete success till now.

I Have to make tile server on both windows and linux.

for windows i used Maperitive and succeeded in generating tiles and then i used this guys code

http://gis.stackexchange.com/questions/84697/viewing-map-tiles-from-maperitive-in-leaflet-or-openlayers

now the prob is tiles are not showing up

Do i need to instal some Apache module for it ? My tiles are kept here

C:\Profiles\Maperitive\Tiles

Where as i am opening html file from server

http://localhost:8080/mwork/maperitive_test1/index_leaf.html

which is kept in here

C:\Profiles\ApachePHP\apache\www\mwork\maperitive_test1

</head>
<body>
     <div style="width: 600px; height: 400px" id="map"></div>
      <script src="leaflet/leaflet.js"></script>
      <script type="text/javascript" src="leaflet/leaflet-src.js"></script>
      <script>
    map = new L.Map('map');

// create the tile layer with correct attribution
var osmUrl='C:\Profiles\Maperitive\TilesMaperitive\Tiles\{z}\{x}\{y}.png';
var osmAttrib='Map data © OpenStreetMap contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 13, maxZoom: 16, attribution: osmAttrib});      

// start the map in South-East England
map.setView(new L.LatLng(73.054519,33.707173 ),13);
map.addLayer(osm);
    var popup = L.popup();

    function onMapClick(e) {
        popup
            .setLatLng(e.latlng)
            .setContent("You clicked the map at " + e.latlng.toString())
            .openOn(map);
    }

    map.on('click', onMapClick);

</script>
</body>

1 Answer 1

2

No, you don't need a special apache module. You don't even need a webserver at all because you can just to open file:///C:/Profiles/ApachePHP/apache/www/mwork/maperitive_test1/index_leaf.html in your browser.

The problem is your osmUrl. Either you have to make C:\Profiles\Maperitive\Tiles available through your webserver. Or you have to replace the URL with file:///C:/Profiles/Maperitive/Tiles/{z}/{x}/{y}.png.

Additionally there is a typo in your URL, Maperitive\TilesMaperitive\Tiles should probably just be Maperitive\Tiles instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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