NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

I have created local tiles using Mapnik. Now I want to display the local tiles on a webpage(JSP Running on tomcat). I have tried html code and it works fine. But it does not work in JSP. Can anybody help me in this?

asked 21 Aug '12, 11:47

Reshma%20Maner's gravatar image

Reshma Maner
235303136
accept rate: 0%

closed 22 Aug '12, 12:34

NicolasDumoulin's gravatar image

NicolasDumoulin
3.3k42256

Can you explain what doesn't work and provide some error messages or log entries if possible?

(21 Aug '12, 12:05) scai ♦
1

var newLayer = new OpenLayers.Layer.OSM("Local Tiles", "tiles/${z}/${x}/${y}.png", {numZoomLevels: 19, alpha: true, isBaseLayer: false}); map.addLayer(newLayer);

This code works fine in html file and the map tiles are opening. But the same code does not open any map image in jsp code. Only pink background is displayed. And if I move the mouse, it displayes lat long attributes also.

(21 Aug '12, 12:20) Reshma Maner

When I check by view source option of browser, it shows tile path as tiles///.png

(21 Aug '12, 12:21) Reshma Maner

I've closed this question as you have opened another one with more details.

(22 Aug '12, 12:34) NicolasDumoulin

The question has been closed for the following reason "Duplicate Question" by NicolasDumoulin 22 Aug '12, 12:34


Are you sure that your Java EE server is configured to serve static files from the directory containing your tiles? Can you access directly to a tile, by bypassing your jsp page?

permanent link

answered 21 Aug '12, 14:23

NicolasDumoulin's gravatar image

NicolasDumoulin
3.3k42256
accept rate: 13%

Yes, I can access the tiles using html sample code given on link below. http://wiki.openstreetmap.org/wiki/OpenLayers_Local_Tiles_Example.

Only if I add the same code in a jsp page, it does not display the images, but on mouse over, lat long is displayed.

(21 Aug '12, 14:31) Reshma Maner

But do you access this html page with your java EE server? BTW, which server do you use?

If you can access directly to tiles with your webserver, you should look at the html code served from your JSP in your browser.

(21 Aug '12, 14:35) NicolasDumoulin

I am using tomcat server.

(21 Aug '12, 14:37) Reshma Maner

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×287
×39
×13
×8

question asked: 21 Aug '12, 11:47

question was seen: 5,112 times

last updated: 22 Aug '12, 12:34

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum