Bonjour à tous,
J'ai un petit soucis depuis hier matin, que je n'arrive pas à résoudre :
J'essaye d'afficher un calque avec une carte IGN (GEOGRAPHICALGRIDSYSTEMS.MAPS) sur un fond de carto GoogleMap ou OpenStreetMap.
Ma carte est faite à partir de OpenLayers 2.10, avec la visionneuse de GeoExt.MapPanel. J'inclue l'API IGN v1.2-m.
Le soucis, c'est que mon fond s'affiche bien, mon calque semble se positionner au bon endroit, sauf qu'il se dédouble. Voici une petite image pour exposer le problème :
Quand je charge la carte, j'arrive sur Bordeaux avec le fond GoogleMap
Quand j'affiche le calque, la zone Bordeaux est dédoublée
Il me semble avoir lu quelque part que pour afficher du WMS sur un Fond GoogleMap avec sphericalMercator, il faut redimensionner les images (les étirer). Le problème c'est qu'il me semble que ça devrait être automatique avec proj4js.
Voici quelques extraits de mon code :
La carte :
1 2 3 4 5 6 7 8 9 10 11
|
this.map = new GeoExt.MapPanel({
map: new OpenLayers.Map(Ext.id(null, 'map_'), {
displayProjection: new OpenLayers.Projection('EPSG:4326'),
projection: new OpenLayers.Projection('EPSG:900913'),
units: 'm',
numZoomLevels: 22,
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)
}),
region: 'center'
}); |
Le fond GoogleMap :
1 2 3 4 5 6 7 8 9 10 11 12 13
|
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{
type: G_PHYSICAL_MAP
,isBaseLayer: true
,projection: new OpenLayers.Projection('EPSG:900913')
,units: 'm'
,sphericalMercator: true
,maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)
,maxResolution: 156543.0339
}
); |
Le calque IGN :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
var cat = new Geoportal.Catalogue(this.getOLMap(), gGEOPORTALRIGHTSMANAGEMENT);
var zon = cat.getTerritory('FXX');
var ignOpts = cat.getLayerParameters(zon, 'GEOGRAPHICALGRIDSYSTEMS.MAPS');
if (cat != null && zon != null && ignOpts != null){
ignOpts.options.resolutions = Geoportal.Catalogue.RESOLUTIONS.slice(
ignOpts.options.minZoomLevel,
ignOpts.options.maxZoomLevel
);
ignOpts.options.isBaseLayer = false;
ignOpts.options.opacity = 0.7;
ignOpts.options['GeoRM'] = Geoportal.GeoRMHandler.addKey(
gGEOPORTALRIGHTSMANAGEMENT.apiKey,
gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey].tokenServer.url,
gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey].tokenServer.ttl,
this.getOLMap()
);
return new ignOpts.classLayer(
OpenLayers.i18n(ignOpts.options.name),
ignOpts.url,
ignOpts.params,
ignOpts.options); |
Et pour finir, voici les requetes envoyées :
Par GoogleMap :
http://mt0.google.com/vt/lyrs=t@128,r@169000000&hl=fr&src=api&x=506&y=368&z=10&s=Galile
Par IGN :
http://wxs.ign.fr/geoportail/wmsc?LAYERS=GEOGRAPHICALGRIDSYSTEMS.MAPS&EXCEPTIONS=text/xml&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=IGNF:GEOPORTALFXX&BBOX=32768,4949896.612773,65536,4973240.076337&WIDTH=256&HEIGHT=256&TILED=true&gppkey=**mykey**
Je suis complètement bloqué, si quelqu'un a une idée géniale, ça serait super
Partager