Hallo zusammen,
ich weiß, hier ist wieder irgendwas mit der Projektion schief, ich finde aber den Fehler nicht bzw. weiß nicht so Recht, wie ich das gerade rücke.
var lon = 7;
var lat = 53;
var zoom = 15;
var map, select;
function init(){
map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'}
);
map.addLayer (new OpenLayers.Layer.OSM.Mapnik('Mapnik'));
var sundials = new OpenLayers.Layer.Vector("KML", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "route.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});
map.addLayers([wms, sundials]);
select = new OpenLayers.Control.SelectFeature(sundials);
sundials.events.on({
"featureselected": onFeatureSelect,
"featureunselected": onFeatureUnselect
});
map.addControl(select);
select.activate();
var fromProjection = new OpenLayers.Projection("EPSG:28992"); // EPSG:4326Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
map.setCenter(position, 12);
map.zoomToExtent(new OpenLayers.Bounds(7,53,8,54));
}
Hat jemand einen Tip für mich?
Vielen Dank im Voraus