[OpenLayers-Users] Openlayers and Mapnik loading problem
Arnd Wippermann
arnd.wippermann at web.de
Fri Nov 2 08:31:05 PDT 2012
it seems, that the url is hardcoded in
OpenLayers.Layer.OSM.Mapnik.initialize
and not changeable by the constructor.
you have to overwrite OpenLayers.Layer.OSM.Mapnik to provide your url.
Arnd
_____
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von robertico
Gesendet: Freitag, 2. November 2012 14:05
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Openlayers and Mapnik loading problem
I'm running my own Openstreetmap server with Mapnik installed.
I tried a simple example but the tiles are not loaded.
The online version works (without the Mapnik part and the url's)
I can load a tile from my server e.g.
http://xxx.xxx.xxx.xxx/osm_tiles/18/137213/91823.png
Please provide me a working sample. (I'm stuck for days)
My code;
<!DOCTYPE HTML>
<html>
<head>
<title>OpenLayers Simplest Example</title>
</head>
<body>
<div id="Map" style="height:600px"></div>
<script src="OpenLayers.js"></script>
<script>
var lat = 47.35387;
var lon = 8.43609;
var zoom = 18;
var fromProjection = new OpenLayers.Projection("EPSG:4326"); //
Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to
Spherical Mercator Projection
var position = new OpenLayers.LonLat(lon, lat).transform(
fromProjection, toProjection);
var url = ["http://xxx.xxx.xxx.xxx/osm_tiles/${z}/${x}/${y}.png",
"http://xxx.xxx.xxx.xxx/osm_tiles/${z}/${x}/${y}.png",
"http://xxx.xxx.xxx.xxx/osm_tiles/${z}/${x}/${y}.png"];
map = new OpenLayers.Map("Map");
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", url);
map.addLayer(mapnik);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
markers.addMarker(new OpenLayers.Marker(position));
map.setCenter(position, zoom);
</script>
</body>
</html>
_____
View this message in context: Openlayers
<http://osgeo-org.1560.n6.nabble.com/Openlayers-and-Mapnik-loading-problem-t
p5013551.html> and Mapnik loading problem
Sent from the OpenLayers
<http://osgeo-org.1560.n6.nabble.com/OpenLayers-Users-f3910695.html> Users
mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121102/9639292f/attachment.html>
More information about the Users
mailing list