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've been stuck on how to use my local tiles which i rendered with mapnik's generate_tiles.py and all the data is on postgresql. I'm kinda confused on what i should do to "feed" the tiles to openlayers. The map would be used in django btw. hoping you could help me with this.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Working on Windows, I have simple duplicated the call of Openstreetmap Tiles, and exchanged the web http access by a link within the local file system:

    var MyMapnikLayer = new OpenLayers.Layer.OSM("myMapnik", "file:///D:/Tiles/myMapnik/${z}/${x}/${y}.png", {numZoomLevels: 16, alpha: true, isBaseLayer: true, visibility: false});
    map.addLayer(MyMapnikLayer);
share|improve this answer
    
thanks. but i get confused with how it displays the tiles since i used the generate_tiles.py and the output of the script is numerous folders categorized by their zoom levels –  iamjoanel Feb 6 '13 at 23:51
    
These folders are just the same structure as defined by D:/Tiles/myMapnik/${z}/${y}/. In my generate_tiles.py, I give this command : try: tile_dir = 'D:/Tiles/myMapnik/' (in two lines) –  Andre Joost Feb 7 '13 at 7:27

You will want to use OpenLayers.Layer.TMS.

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.