updated form text
[libreplanet-static.git] / js
1
2
3
4 <script type="text/javascript" src="/OpenLayers.js"></script>
5
6
7 <!-- bring in the OpenLayers javascript library
8 (here we bring it from the remote site, but you could
9 easily serve up this javascript yourself) -->
10 <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
11
12 <!-- bring in the OpenStreetMap OpenLayers layers.
13 Using this hosted file will make sure we are kept up
14 to date with any necessary changes -->
15 <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
16
17 <script type="text/javascript">
18 // Start position for the map (hardcoded here for simplicity,
19 // but maybe you want to get from URL params)
20 // (Though to get it from the URL it's simpler to use the Permalink and ArgParser controls)
21 var lat=43
22 var lon=-0
23 var zoom=3
24
25 var map; //complex object of type OpenLayers.Map
26
27
28 map = new OpenLayers.Map ("map", {
29 controls:[
30 new OpenLayers.Control.Navigation(),
31 new OpenLayers.Control.PanZoomBar(),
32 new OpenLayers.Control.Attribution()],
33 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
34 maxResolution: 156543.0399,
35 numZoomLevels: 19,
36 units: 'm',
37 projection: new OpenLayers.Projection("EPSG:900913"),
38 displayProjection: new OpenLayers.Projection("EPSG:4326")
39 } );
40
41
42 // Define the map layer
43 // Note that we use a predefined layer that will be
44 // kept up to date with URL changes
45 // Here we define just one layer, but providing a choice
46 // of several layers is also quite simple
47 // Other defined layers are OpenLayers.Layer.OSM.Mapnik, OpenLayers.Layer.OSM.Maplint and OpenLayers.Layer.OSM.CycleMap
48 layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender("Osmarender");
49 map.addLayer(layerTilesAtHome);
50
51 if( ! map.getCenter() ){
52 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
53 map.setCenter (lonLat, zoom);
54 }
55
56
57 </script>