[OpenLayers-Users] different behaviours within browsers
Manuele
amicogodzilla at bruttocarattere.org
Mon May 23 06:00:38 EDT 2011
Hi *,
can somebody help to understand why this[1] code is correctly
intrerpreted from some browsers and not from others... in particular I
have problem with IE (on windows) and iceweesel (on debian/linux) and
not with firefox on windows, Chrome on linux and Epiphany on linux
thank you very mutch in advance
Manuele
[1] Here is the code...
<link rel="stylesheet"
href="http://openlayers.org/dev/theme/default/style.css" type="text/css" />
<link rel="stylesheet"
href="http://openlayers.org/dev/examples/style.css" type="text/css" />
<script src="http://openlayers.org/dev/OpenLayers.js"></script>
<script type="text/javascript">
function init(){
//OpenLayers.ProxyHost="/proxy/?url=";
var prop_proj = new OpenLayers.Projection("EPSG:900913");
var disp_proj = new OpenLayers.Projection("EPSG:4326");
bounds = new OpenLayers.Bounds();
bounds.extend(new OpenLayers.LonLat(13.751,37.179).transform(
disp_proj, // transform from WGS 1984
prop_proj // to Spherical Mercator Projection
)
);
bounds.extend(new OpenLayers.LonLat(15.602,41.844).transform(
disp_proj, // transform from WGS 1984
prop_proj // to Spherical Mercator Projection
)
);
var options = {
projection: prop_proj,
displayProjection: disp_proj,
units: "m",
numZoomLevels: 20,
maxResolution: 156543.0339,
maxExtent: bounds
};
var map = new OpenLayers.Map('map', options);
//Set the Base Layers
var osm = new OpenLayers.Layer.OSM("OpenStreetMap");
map.addLayer(osm);
map.zoomToExtent(bounds);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
var size = new OpenLayers.Size(25,32);
//var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new
OpenLayers.Icon("/wind2pow/static/images/marker_wind.png", size);
var marker
marker = new OpenLayers.LonLat( 13.751 ,37.234 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
marker = new OpenLayers.LonLat( 15.602 ,41.281 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
marker = new OpenLayers.LonLat( 14.285 ,37.867 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
marker = new OpenLayers.LonLat( 15.436 ,41.002 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
marker = new OpenLayers.LonLat( 14.142 ,41.441 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
marker = new OpenLayers.LonLat( 14.764 ,37.230 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
marker = new OpenLayers.LonLat( 14.701 ,37.179 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
marker = new OpenLayers.LonLat( 15.074 ,41.844 )
.transform(
new OpenLayers.Projection("EPSG:4326"), //
transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator
Projection
);
markers.addMarker(new OpenLayers.Marker(marker, icon.clone()));
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
//map.zoomToMaxExtent();
}
</script>
<center>
<div id="map" class="smallmap" style="width: 400px; height: 300px"></div>
<script>init();</script>
</center>
More information about the Users
mailing list