You are not logged in.
- Topics: Active | Unanswered
Announcement
*** NOTICE: forum.openstreetmap.org is being retired. Please request a category for your community in the new ones as soon as possible using this process, which will allow you to propose your community moderators.
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***
Please create new topics on the new site at community.openstreetmap.org. We expect the migration of data will take a few weeks, you can follow its progress here.***
Pages: 1
#1 2013-05-21 18:11:19
- Ghostrider82
- Member
- Registered: 2010-05-25
- Posts: 132
Ich bin schon wieder in Afrika
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
Offline
#2 2013-05-21 18:31:22
- Ghostrider82
- Member
- Registered: 2010-05-25
- Posts: 132
Re: Ich bin schon wieder in Afrika
Kommando zurück....
falsche Projektion, richtig wäre 4326 gewesen -.-
Offline
Pages: 1