Method for getting both feature id and data.

Having to call two methods to get complete feature information (id and data) is cumbersome.  The `getFeatureInfo` method returns an object with both feature id and data.
This commit is contained in:
Tim Schaub
2012-02-28 05:37:28 -07:00
parent 19a11561e8
commit 4d31a3ed3a
6 changed files with 75 additions and 54 deletions
+9 -8
View File
@@ -58,17 +58,18 @@
);
map.addLayers([bio_utfgrid,world_utfgrid]);
var callback = function(dataLookup) {
var callback = function(infoLookup) {
var msg = "";
if (dataLookup) {
var layer, data;
for (var idx in dataLookup) {
if (infoLookup) {
var layer, info;
for (var idx in infoLookup) {
layer = map.layers[idx];
data = dataLookup[idx];
if (data) {
info = infoLookup[idx];
if (info && info.data) {
msg += "<strong>" + layer.name + "</strong><br>";
for (var key in data) {
msg += key + ": " + data[key] + "<br>";
msg += "feature id: " + info.id + "<br>";
for (var key in info.data) {
msg += key + ": " + info.data[key] + "<br>";
}
}
}