[OpenLayers-Users] Getting values from a WMS with GeoTiff file
Riccardo Di Stefano
riccardo.distefano at i-em.eu
Thu Dec 5 03:09:39 PST 2013
Hello everyone!
I'm quite new to OpenLayers, and completely new to WMS querying. I'm needing
some help here.
I have to query values of a WMS hosted by Geoserver from a GeoTiff file.
What is the best way? Following the examples I found on the web (i.e.
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/getfeatureinfo
-control.html), I tried to perform a WMSGetFeatureInfo like follows:
function initialize(){
var resolutions =
OpenLayers.Layer.Bing.prototype.serverResolutions.slice(MYMIN, MYMAX);
var layer_BNI = new OpenLayers.Layer.WMS("MY TITLE",
"http://localhost:8080/geoserver/wms",
{ 'layers': 'MYLAYER', transparent: true, format: 'image/png' },
{ isBaseLayer: false }
);
var map = new OpenLayers.Map({
div: MYDIV,
theme: null,
projection: "EPSG:900913",
layers: [
layer_BNI,
new OpenLayers.Layer.OSM("MapQuest-OSM Tiles", arrayOSM, {
attribution: "<p>Data, imagery and map information provided by <a
href='http://www.mapquest.com/' target='_blank'>MapQuest</a>, <a
href='http://www.openstreetmap.org/' target='_blank'>Open Street Map</a> and
contributors, <a href='http://creativecommons.org/licenses/by-sa/2.0/'
target='_blank'>CC-BY-SA</a> <img
src='http://developer.mapquest.com/content/osm/mq_logo.png'
border='0'></p>",
transitionEffect: "resize",
zoomOffset: MYMIN,
resolutions: resolutions
})
],
controls: [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.Navigation()
],
center: [0, 0],
zoom: MYZOOM
});
var info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost:8080/geoserver/wms',
title: 'Identify features by clicking',
layers: [layer_BNI],
eventListeners: {
getfeatureinfo: getInfo
},
queryVisible: true
});
map.addControl(info);
info.activate();
}
function getInfo(event) {
//event is always empty
}
My layers are loaded and shown correctly, getInfo is fired correctly, but
event.text is ALWAYS an empty string.
With QGIS values are extracted correctly from my WMS, so I guess the issue
is not WMS-side but client-side.
What am I doing wrong?
Thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20131205/4b1dd8fb/attachment.html>
More information about the Users
mailing list