--- step-1/index.html 2023-07-02 13:20:09.119154723 +0000 +++ step-2/index.html 2023-07-02 13:20:09.119154723 +0000 @@ -1,13 +1,20 @@ <html> <head> - <title>Step 1: A Simple Map</title> + <title>Step 2: setting initial position</title> <script src="../OpenLayers.js"></script> <script src="../OpenStreetMap.js"></script> <script> function init() { + lat = 52.025; + lon = 8.515; + zoom = 15; + + projLonLat = new OpenLayers.Projection("EPSG:4326"); // WGS 1984 + projMercator = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator + map = new OpenLayers.Map("demoMap"); map.addLayer(new OpenLayers.Layer.OSM.Mapnik()); - map.zoomToMaxExtent(); + map.setCenter(new OpenLayers.LonLat(lon, lat).transform(projLonLat,projMercator), zoom); } </script> </head>