Am 22.08.2012 09:48, schrieb Reshma Maner:
Hi,

I have set up osm2pgsql,mapnik on ubuntu server. I have also generated tiles locally. Now I want to display these tiles on map in a JSP page. I am using open layers. I have been trying it. The code works fine in html, but if same thing I do in a jsp page, it does not open map tiles. Only pink canvas is displayed. On rightclick, it displayes map tile path as "/LocalFolder///.png". source code is given below. Please let me know what is the procedure I should follow to display local map on a jsp page(Tomcat server),
Code:


          var newLayer = new OpenLayers.Layer.OSM("Localhost",
"IndiaMap/${z}/${x}/${y}.png", {numZoomLevels: 4, alpha: true,
isBaseLayer: true});
Here's the correct path required.
I guess, what you call "LocalFolder" above is "IndiaMap", but make sure that this relative URL (so base url of the jsp page + /IndiaMap/ leads to the corresponding folder.

The HTML page is mapped directly to the file system; the JSP-file is mapped differently through the java aware web server. One possibility is to use the complete URL here, so instead "IndiaMap/${z}/${x}/${y}.png" use "http://complete-url-like-you-see-it.in/the/image/properties/on/the/working/html-file/IndiaMap/${z}/${x/${y}.png";, where - sure, IndiaMap/... should not be doubled.

regards
Peter

_______________________________________________
dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/dev

Reply via email to