#1 Tue 03 August 2010 12:42
- GeoPAN
- Juste Inscrit !
- Date d'inscription: 6 Jul 2010
- Messages: 7
[OpenLayers] WMSGetFeatureInfo n'affiche rien
Bonjour.
Depuis la création d'un magasin à partir duquel je peux ajouter des couches à ma carte, la fonction WMSGetFeatureInfo ne retourne plus aucun résultat. Tout marchait bien quand je définissais les couches directement dans le map.
Voilà mon bouton info :
Code:
//Info control, a "button" control
action = new GeoExt.Action({
control: new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://[serveur]/geoserver/wms',
title: 'Identify features by clicking',
queryVisible: true,
eventListeners: {
getfeatureinfo: function (event) {
var output = event.text,
idialog = new Ext.Window({
title: "Feature Info",
layout: "fit",
//autoHeight: true,
width: 800,
Height: 600,
plain: true,
constrain: true,
items: [{
border: true,
bodyStyle: {
padding: 5,
fontSize: 13
},
html: output
}]
});
idialog.show();
}
},
out: true
}),
tooltip: 'Info: click in the map to get object attribute info',
map: map,
iconCls: 'info',
toggleGroup: 'map'
});Et voilà à partir de quoi je contrôle les couches que je peux ajouter à ma carte.
Code:
// create a new WMS capabilities store
var store = new GeoExt.data.WMSCapabilitiesStore({
url: "http://[serveur]/geoserver/wms?request=getCapabilities"
});
// load the store with records derived from the doc at the above url
store.load();
//*************************
//*** Grid Config ***
//*************************
var xg = Ext.grid;
// row expander
var expander = new Ext.grid.RowExpander({
tpl: new Ext.Template("<p><b>Abstract :</b> {abstract}</p>")
});
var sm = new xg.CheckboxSelectionModel();
//var sm = new xg.RowSelectionModel({singleSelect:true});
// create a grid to display records from the store
var grid = new xg.GridPanel({
store: store,
plugins: [expander],
cm: new xg.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns: [
expander, sm,
{
header: "Name",
dataIndex: "name",
sortable: true
},
//{header: "Workspace", dataIndex: "name", , sortable: true},
{
id: "title",
header: "Title",
dataIndex: "title",
sortable: true
}]
}),
sm: sm,
autoExpandColumn: "title",
height: 300,
width: 650,
floating: false,
x: 10,
y: 0,
bbar: ["->",
{
//text:"Add Layers",iconCls:"icon-addlayers"
tooltip: "Add Layer to the map",
iconCls: "mapadd",
handler: function () {
var record = grid.getSelectionModel().getSelected();
if (record) {
var copy = record.copy();
// Ext 3.X does not allow circular references in objects passed
// to record.set
copy.data["layer"] = record.get("layer");
copy.get("layer").mergeNewParams({
format: "image/png",
transparent: "true"
}, {
isBaseLayer: false,
buffer: 0
});
mapPanel.layers.add(copy);
mapPanel.map.zoomToExtent(
OpenLayers.Bounds.fromArray(copy.get("llbbox")));
}
},
scope: this
}]
});Il s'agit de bouts de code récupérés sur différents tuto sur le net. Je ne comprends pas complètement la logique de l'alchimie GeoExt, Extjs, OpenLayer mais mis à part ce GetFeatureInfo, ça marche plutôt pas mal.
En espérant une solution des experts du forum.
Merci
Hors ligne
#2 Tue 03 August 2010 13:11
Re: [OpenLayers] WMSGetFeatureInfo n'affiche rien
Bonjour,
Première chose à tester généralement quand cela ne marche pas : la requête envoyée par OL est elle correcte ? Il faut utiliser firebug pour récupérer l'url.
Y.
Yves Jacolin, bénévole de l'association GeoRezo.net, agit au nom et pour le compte de l'association - Partageons ce qui nous départage !! - GeoRezo vous aide ? Aidez GeoRezo !
Hors ligne
#3 Tue 03 August 2010 16:23
- GeoPAN
- Juste Inscrit !
- Date d'inscription: 6 Jul 2010
- Messages: 7
Re: [OpenLayers] WMSGetFeatureInfo n'affiche rien
Le problème c'est que firebug n'affiche aucune url, j'ai l'impression que le controle associé au bouton ne se lance même pas.
Hors ligne


