[OpenLayers-Users] Google and GML layer
Jacolin Yves
yjacolin at free.fr
Thu Dec 6 08:54:46 EST 2007
Hi,
One ofmy friend is trying to create a map with a Google layer as baseLayer and
he added a GML layer. I converted his shapefile from WGS84 to
SphericalMercator with ogr then he converted it in GML file.
The map is ok except for the GML layer where there is still an y-offset. Do
you know what we forgot to do?
Here is the code:
/*************************
var options = {
projection: "EPSG:900913",
units: "m",
maxResolution: 156543.0339,
maxExtent: new
OpenLayers.Bounds(364083,5588661,727574,5877025)
};
var map = new OpenLayers.Map('map',options);
// ajout de quelques options de controle (barre pour gerer les zooom, icones
zom, pan, etc., choix des couches)
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MousePosition());
// couches a charger :
// var google = new OpenLayers.Layer.Google( "Google Satellite" ,
// {type: G_NORMAL_MAP, 'maxZoomLevel':1, 'sphericalMercator': true}
// );
var google = new OpenLayers.Layer.Google(
"Google Streets",
{type: 'G_NORMAL_MAP', 'sphericalMercator': true}
);
var gml = new
OpenLayers.Layer.GML("Regions", "OL_CCIL_fichiers/Mono2006_2.gml",
{fillColor: "#ee9900", fillOpacity:0.4, 'isBaseLayer': false}
);
//on definie la visibilite par defaut pour gml a true :
gml.setVisibility(true);
map.addLayers([google,gml]);
//on centre sur Lyon
map.setCenter(new OpenLayers.LonLat(4.836381,45.764583), 10);
/****************************
Thanks for your help,
Y.
--
Yves Jacolin
---
http://softlibre.gloobe.org
More information about the Users
mailing list