Blog di Gianni Barrotta

prova pagina

#map {
width: 100%;
height: 99%;
border: 1px solid black;
}
.olPopup p { margin:0px; font-size: .9em;}
.olPopup h2 { font-size:1.2em; }

var map;

function init(){
var options = {
projection: new OpenLayers.Projection(“EPSG:900913”),
displayProjection: new OpenLayers.Projection(“EPSG:4326”),
units: “m”,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
20037508.34, 20037508.34),
controls:[new OpenLayers.Control.MouseDefaults(),new OpenLayers.Control.MousePosition()]
};

map = new OpenLayers.Map(‘map’, options);
var mapnik = new OpenLayers.Layer.TMS(
“OpenStreetMap (Mapnik)”,
http://tile.openstreetmap.org/”,
{
type: ‘png’,
getURL: osm_getTileURL,
‘maxZoomLevel’:17,
displayOutsideMaxExtent: true
}
);
var gmap = new OpenLayers.Layer.Google(“Google”, {sphericalMercator:true,’maxZoomLevel’:17});

var IT2000 = new OpenLayers.Layer.WMS( “Ortofoto IT2000”,
http://88.53.214.52/arcgis/services/OrtofotoIT_2000_f33/MapServer/WMSServer”, {layers: ‘0’},{units: ‘meters’, projection: “EPSG:4326”,’maxExtent’: new OpenLayers.Bounds(250000,3800000,430000,4500000),’maxResolution’: “auto” });

// map.addLayer(IT2000);
var CTR = new OpenLayers.Layer.WMS( “CTR”,
http://88.53.214.52/arcgis/services/CTR_10000_Raster_f33/MapServer/WMSServer”, {layers: ‘0’,transparent: ‘true’},{units: ‘meters’, projection: “EPSG:32633”,’maxExtent’: new OpenLayers.Bounds(250000,3800000,430000,4500000),’maxResolution’: “auto” } );

map.addLayers([ gmap, mapnik]);

// gpx layer
map.addLayer(new OpenLayers.Layer.GML(“GPX”, “gpx/W20090510163149.gpx”,
{
format: OpenLayers.Format.GPX,
projection: map.displayProjection,
formatOptions:{ extractWaypoints:true,
extractTracks:true,
extractRoutes:true,
extractAttributes:true
}
}));

map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(14.91,36.785).transform(map.displayProjection, map.projection),14);

}

function osm_getTileURL(bounds) {
var res = this.map.getResolution();
var x = Math.round((bounds.left – this.maxExtent.left) / (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top – bounds.top) / (res * this.tileSize.h));
var z = this.map.getZoom();
var limit = Math.pow(2, z);

if (y = limit) {
return OpenLayers.Util.getImagesLocation() + “404.png”;
} else {
x = ((x % limit) + limit) % limit;
return this.url + z + “/” + x + “/” + y + “.” + this.type;
}
}

Al momento, non c'è nessun commento.

Lascia un commento