823
edits
(restate purpose) |
(try copying https://wiki.openstreetmap.org/wiki/OpenLayers_Marker) |
||
Line 2: | Line 2: | ||
This is a homebrew attempt at making an OSM widget in mediawiki, fancier than the official extension will allow. | This is a homebrew attempt at making an OSM widget in mediawiki, fancier than the official extension will allow. | ||
</noinclude><includeonly> | </noinclude><includeonly> | ||
< | <div style="width:<!--{$w|escape:'html'|default:425}-->;height:<!--{$h|escape:'html'|default:350}-->;border:1px solid black;margin:0px;" id="mapdiv"></div> | ||
<script src="http://www.openlayers.org/api/OpenLayers.js"></script> | |||
<script> | |||
map = new OpenLayers.Map("mapdiv"); | |||
map.addLayer(new OpenLayers.Layer.OSM()); | |||
var lonLat = new OpenLayers.LonLat( <!--{$mklon|escape:'html'|default:-122.267652}--> ,<!--{$mklat|escape:'html'|default:37.810963}--> ) | |||
.transform( | |||
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 | |||
map.getProjectionObject() // to Spherical Mercator Projection | |||
); | |||
var zoom=16; | |||
var markers = new OpenLayers.Layer.Markers( "Markers" ); | |||
map.addLayer(markers); | |||
markers.addMarker(new OpenLayers.Marker(lonLat)); | |||
map.setCenter (lonLat, zoom); | |||
</script> | |||
</includeonly> | </includeonly> |