[OpenLayers-Users] Openlayers and Mapnik loading problem
Dariusz Bączkowski
dariusz.baczkowski at esyscoder.pl
Fri Nov 2 08:53:42 PDT 2012
Dnia piątek, 2 listopada 2012 o 16:31:05 Arnd Wippermann napisał(a):
> 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
I use something like this:
var mapnik_layer = new OpenLayers.Layer.OSM(
"Mapnik OpenStreetMap servers",
[
"http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
],
{
numZoomLevels: 19,
buffer: 0,
transitionEffect: "resize"
});
I works with any URLs list.
>
>
>
> _____
>
> 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.
--
Pozdrawiam,
Dariusz Bączkowski
e-mail: dariusz.baczkowski at esyscoder.pl
tel.: +48 609 123 954
ESYSCODER Dariusz Bączkowski
ul. Lelewela 13A/7
75-450 Koszalin
NIP: 669-238-28-99
www.esyscoder.pl
e-mail: biuro at esyscoder.pl
tel.: +48 609 123 954
fax: +48 947 166 554
More information about the Users
mailing list