Revision [2233]

Last edited on 2008-10-04 23:38:31 by BenoitAudouard [try iframe]
"" <iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src=",53.9,34,69.9&layer=mapnik" style="border: 1px solid black"></iframe>""
"" <!-- bring in the OpenLayers javascript library
(here we bring it from the remote site, but you could
easily serve up this javascript yourself) -->
<script src=""></script>
<!-- bring in the OpenStreetMap OpenLayers layers.
Using this hosted file will make sure we are kept up
to date with any necessary changes -->
<script src=""></script>
<script type="text/javascript">
// Start position for the map (hardcoded here for simplicity,
// but maybe you want to get from URL params)
var lat=51.508
var lon=-0.118
var zoom=13

var map; //complex object of type OpenLayers.Map
//Initialise the 'map' object
function init() {
map = new OpenLayers.Map ("map", {
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Attribution()],
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0399,
numZoomLevels: 19,
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
} );
// Define the map layer
// Note that we use a predefined layer that will be
// kept up to date with URL changes
// Here we define just one layer, but providing a choice
// of several layers is also quite simple
// Other defined layers are OpenLayers.Layer.OSM.Mapnik, OpenLayers.Layer.OSM.Maplint and OpenLayers.Layer.OSM.CycleMap
layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender("Osmarender");
var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
map.setCenter (lonLat, zoom);
<!-- define a DIV into which the map will appear. Make it take up the whole window -->
<div style="width:50%; height:50%" id="map"></div>""

Revision [2232]

Edited on 2008-10-04 23:22:22 by BenoitAudouard [add init]
<!-- body.onload is called once the page is loaded (call the 'init' function) -->

Revision [2231]

The oldest known version of this page was created on 2008-10-04 23:21:14 by BenoitAudouard [add init]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki