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 created a tile server with OSM-data in the German style. The data is quite similar to the official tile server for openstreetmap.de, provided by Fraunhofer IOSB.

http://tile.iosb.fraunhofer.de/tiles/osmde/${z}/${x}/${y}.png

If I include the standard OSM-server

http://a.tile.openstreetmap.org/${z}/${x}/${y}.png

with the following constructor

new OpenLayers.Layer.OSM("OSM",myOSMURL,{...});

I get a valid map. The OpenCycleMap tile server works as well.

If I want to use my own tile server or the one from Fraunhofer, the browser successfully gets an respond to the GET-request from the tile server and loads the tiles needed, but doesn't show them in the map.

Following the steps here, I generated a map with local data successfully. Nevertheless, if I replace the link of the local data with a link to Fraunhofer or my tile server, the browser still loads the tiles, but doesn't show them.

// This is the layer that uses the locally stored tiles
//var newLayer = new OpenLayers.Layer.OSM("Local Tiles", "tiles/${z}/${x}/${y}.png", {numZoomLevels: 19, alpha: true, isBaseLayer: false});
var newLayer = new OpenLayers.Layer.OSM("Local Tiles", "http://tile.iosb.fraunhofer.de/tiles/osmde/${z}/${x}/${y}.png", {numZoomLevels: 19, alpha: true, isBaseLayer: false});
map.addLayer(newLayer);
// This is the end of the layer

enter image description here Image in full resolution: http://i.stack.imgur.com/73jOX.jpg

How do I get the tiles from my tile server or Fraunhofer to my map?

share|improve this question
    
OSM Wiki has the answers in this case wiki.openstreetmap.org/wiki/OpenLayers_Local_Tiles_Example (then move to your server) –  Mapperz May 21 '13 at 16:23
    
I downloaded my data and stored them locally. Following the instructions on the wiki, I successfully loaded the local data. Nevertheless, if I replace the link to the local data with a link to Fraunhofer or my tile server, the browser still loads the tiles, but doesn't show them. I'll add an image to the question, which shows that. –  ischas May 22 '13 at 7:41
    
You could use a TileCache Layer: openlayers.org/dev/examples/tilecache.html –  Devdatta Tengshe May 22 '13 at 8:06
2  
You could also use an XYZ layer: openlayers.org/dev/examples/mapbox.html –  Devdatta Tengshe May 22 '13 at 8:09
1  
Okay, I think I found a solution: I use XYZ layer and add the attribute sphericalMercator: true. Thank you all! @DevdattaTengshe: If you like, then provide your suggestion in combination with my last comment as answer. If not, I'll write an answer by myself. I'm still curious about the fact, that OpenLayers.Layer.OSM doesn't work, because it did with other data. –  ischas May 22 '13 at 11:53
show 5 more comments

2 Answers

up vote 2 down vote accepted

You could use an XYZ layer in Openlayers. This layer should be used in OpenLayers, whenever you have tiles arranged by a standard XYZ grid. This tileset format has been popularized by OSM & then Mapbox.

A Sample is presented here: http://openlayers.org/dev/examples/mapbox.html

For an OSM-like layer you should set the property sphericalMercator: true, so that properties like maxExtent and projectionare set to default values for OSM. For more details see the source code of the XYZ layer.

share|improve this answer
add comment

If the problem depends on the browser you use, it might well be a question of Same Origin Policy.

See http://romkey.com/2011/04/23/getting-around-same-origin-policy-in-web-browsers/ for some hints.

share|improve this answer
    
The map works on IE and Chrome, but not on Firefox. I disabled Same Origin Policy in Firefox, but it didn't help. But even if it would have helped: The map I'm building isn't just for my personal use, so a deep intrusion in the way the browser is started cannot be the answer to my problem. –  ischas May 22 '13 at 13:49
add comment

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.