User Tools

Site Tools


tecnica:gps_cartografia_gis:openlayers_900913

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tecnica:gps_cartografia_gis:openlayers_900913 [2010/11/05 14:23] niccolotecnica:gps_cartografia_gis:openlayers_900913 [2010/11/05 14:47] (current) niccolo
Line 11: Line 11:
  
 Vedere la FAQ a proposito di **[[http://proj.maptools.org/faq.html#sphere_as_wgs84|PROJ.4 e Virtual Earth]]**. Vedere la FAQ a proposito di **[[http://proj.maptools.org/faq.html#sphere_as_wgs84|PROJ.4 e Virtual Earth]]**.
 +
 +===== Il codice JavaScript =====
 +
 +OpenLayers supporta attualmente le mappe OpenStreetMap tramite l'oggetto **''OpenLayers.Layer.OSM()''** sebbene nella documentazione ufficiale (versione 2.10) questo non sia ancora documentato.
 +
 +Esiste la possibilità di caricare una piccola libreria JavaScript che estende l'oggetto **''OpenLayers.Layer.OSM()''** e permette di avere le sotto-classi **''Mapnik''**, **''Osmarender''** e **''CycleMap''**.
 +
 +Il codice JavaScript è disponibile al seguente indirizzo: [[http://www.openstreetmap.org/openlayers/OpenStreetMap.js]].
 +
 +Alcuni esempi basici si trovano qui: **[[http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example|OpenLayers Simple Example]]**.
 +
 +Ecco ad esempio un estratto di codice JavaScript:
 +
 +<code javascript>
 +// Define the map object.
 +map = new OpenLayers.Map('map', {
 +    maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
 +    controls: [
 +        new OpenLayers.Control.Navigation(),
 +        new OpenLayers.Control.PanZoomBar(),
 +        new OpenLayers.Control.LayerSwitcher(),
 +        new OpenLayers.Control.KeyboardDefaults(),
 +        new OpenLayers.Control.Scale()
 +    ],
 +    scales: [500000, 200000, 100000, 50000, 25000, 10000, 5000],
 +    units: 'm',
 +    projection: new OpenLayers.Projection("EPSG:900913"),
 +    displayProjection: new OpenLayers.Projection("EPSG:4326")
 +});
 +
 +// Add OpenStreetMap Mapnik layer.
 +var layerMapnik = new OpenLayers.Layer.OSM("OpenStreetMap");
 +layerMapnik.transitionEffect = "resize";
 +layerMapnik.isBaseLayer = true;
 +map.addLayer(layerMapnik);
 +</code>
  
 ===== Mostrare un mark sulla mappa OSM ===== ===== Mostrare un mark sulla mappa OSM =====
tecnica/gps_cartografia_gis/openlayers_900913.txt · Last modified: 2010/11/05 14:47 by niccolo