Openlayers3 leaflet osm problem of displaying data

المشرف العام

Administrator
طاقم الإدارة
I'm a newbie in GIS world and recently built my own private osm tile server infrastructure that will be used in closed environment only and it works as a charm.

I tested the server inserting Leaflet code

var map = L.map('map').setView([48.1333,11.5667], 13); L.tileLayer('http://{s}.mytileserver/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(map); L.marker([48.1333,11.5667]).addTo(map) .bindPopup('A pretty CSS3 popup.
Easily customizable.') .openPopup(); The marker exactly points to Munich and it works perfectly.

Next I tried to do almost the same by using Openlayers example:

var centerpos = [48.1333,11.5667]; // position in degrees var newpos = ol.proj.transform(centerpos,'EPSG:4326','EPSG:900913'); var map = new ol.Map({ view : new ol.View({ projection : 'EPSG:900913', center : newpos, zoom : 8.5, minZoom : 2, maxZoom : 12.5 }), layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], target : 'map' }); and the map created shows somewhere near Djibouti - Africa. What have I done wrong with Openlayers3 example ?

Or did I do something wrong with installation of mapnik/postgis/osm ?

Thanks in advance.



أكثر...
 
أعلى