Max
Max

Reputation: 99

Tiles load incorrectly in my own web-server OSM

I successfully installed tile server based on the instruction given in the switch2osm.org/serving-tiles/manually-building-a-tile-server-14-04/. Also I set up apache web-server and took slippymap.html from github.com/openstreetmap/mod_tile/blob/master/slippymap.html. But when I open slippymap in browser I got error tiles but almost all of them have request status 200 (load correctly). And size of every tile is 0 kb. But if I open tile in new tab it displayed correctly.

There is the layer that uses the locally stored tiles:

var newLayer = new OpenLayers.Layer.OSM("Local Tiles", "http://127.0.0.1/osm_tiles/${z}/${x}/${y}.png", {numZoomLevels: 19});
map.addLayer(newLayer);

This I have in console: Image from origin http://127.0.0.1 has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin http://192.168.224.132 (machine IP-address in local) is therefore not allowed access.

This is in all browsers.

Upvotes: 3

Views: 1242

Answers (1)

Max
Max

Reputation: 99

I found solution - https://gis.stackexchange.com/questions/71715/enabling-cors-in-openlayers. Sorry, I have no experience in web development and gis. It is my first task.

Upvotes: 1

Related Questions