[Gfoss] OpenLayers e mapfile

Walter Lorenzetti lorenzetti a faunalia.it
Ven 22 Ago 2008 16:13:30 CEST


francesco334 ha scritto:
> Ciao a tutti,
>
> sto provando OpenLayers con layer base quello di Google:
>             map = new OpenLayers.Map('map');
>             map.addControl(new OpenLayers.Control.LayerSwitcher());
>             
>             var gphy = new OpenLayers.Layer.Google(
>                 "Google Physical",
>                 {type: G_PHYSICAL_MAP}
>             );
>
> Poi ho aggiunto un layer (della regione puglia) contenuto nel miofile map
> (Gmap75):
>           var dm_wms = new OpenLayers.Layer.WMS("GMap75",
> "http://localhost:8081/cgi-bin/mapserv.exe?",
>                 {map: '/ms4w/apps/gmap-puglia/htdocs/gmap75.map', layers:
> "comuni",
>                  transparent: "true", format: "image/png"});
>
> Il risultato è che, mi vien fuori sia la mappa di google, ma anche il mio
> layer.
> L'unico problema è che il mio layer (cioè i confini della regione Puglia)
> viene visualizzato fuori dall'Italia (sopra il Mar Morto!).
>
> Cos'è diverso? Il PROJECTION?? (nel mio mapfile è: "init=epsg:26592" è lo
> stesso di quello di Google?) 
>
> http://www.nabble.com/file/p19107648/Immagine.JPG Immagine.JPG 
>
>   
Ciao Francesco,

no google è "in a Mercator projection"(
http://en.wikipedia.org/wiki/Mercator_projection) che è stato
recentemente aggiunto alla lista epsg come EPSG 90013... comunque per
sovrapporre layer ad uno stro di google prova ad aggiungere l'opzione
{'reproject': true} alla fine:

var dm_wms = new OpenLayers.Layer.WMS("GMap75",
"http://localhost:8081/cgi-bin/mapserv.exe?",
                {map: '/ms4w/apps/gmap-puglia/htdocs/gmap75.map', layers:
"comuni",
                 transparent: "true", format: "image/png"},{'reproject': 
true});

questo link ti può essere di aiuto

http://openlayers.org/dev/examples/google-reproject.html

ciao
W



-- 
Please no  .doc, .xls, .ppt, .dwg:
https://www.faunalia.it/dokuwiki/doku.php?id=public:OpenFormats

Walter Lorenzetti
email+jabber: lorenzetti at faunalia.it
www.faunalia.it
Cell: (+39) 347-6597931  Tel+Fax: (+39) 0587-213742
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy





Maggiori informazioni sulla lista Gfoss