Skip to content

Commit

Permalink
New client setting in settings.template to overwrite Identify name fo…
Browse files Browse the repository at this point in the history
…r raster files (Band 1 -> anything you set)

Identify Window - layer name also for raster
  • Loading branch information
uprel committed Dec 20, 2017
1 parent 32228a3 commit d83b2d0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
22 changes: 9 additions & 13 deletions client/site/js/FeatureInfoDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,22 +422,22 @@ function parseFIResult(node) {
var hasAttributes = false;
var rasterData = false;
var htmlText = "";
//if (showFILayerTitle) {
// htmlText += "<h2>" + wmsLoader.layerProperties[node.getAttribute("name")].title + "</h2>";
//}

var layerChildNode = node.firstChild;
var layerTitle = wmsLoader.layerProperties[node.getAttribute("name")].title;
if (showFILayerTitle) {
htmlText += "<h2>" + layerTitle + "</h2>";
}

var fid = layerTitle+"."+node.firstElementChild.id;
while (layerChildNode) {



if (layerChildNode.hasChildNodes() && layerChildNode.nodeName === "Feature") {
var attributeNode = layerChildNode.firstChild;

if (showFILayerTitle) {
htmlText += "<h2>" + layerTitle + "</h2>";
}

htmlText += '\n <p></p>\n <table>\n <tbody>';
htmlText += '<table><tbody>';
//case vector data

//add geometry actions if layer is WFS published or geometry is added to response
Expand Down Expand Up @@ -503,7 +503,7 @@ function parseFIResult(node) {
if (rasterData == false) {
htmlText += "\n <p></p>\n <table>\n <tbody>";
}
htmlText += '\n<tr><td>' + layerChildNode.getAttribute("name") + '</td><td>' + layerChildNode.getAttribute("value") + '</td></tr>';
htmlText += '\n<tr><td>' + getRasterFieldName(layerTitle, layerChildNode.getAttribute("name")) + '</td><td>' + layerChildNode.getAttribute("value") + '</td></tr>';
hasAttributes = true;
rasterData = true;
}
Expand Down Expand Up @@ -698,8 +698,4 @@ function identifyAction(type,id) {

}





}
11 changes: 11 additions & 0 deletions client_common/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,16 @@
}
};

function getRasterFieldName(layer, name) {
if (!(Eqwc.settings.overWriteRasterFieldName && Eqwc.settings.overWriteRasterFieldName[layer])) {
return name;
}
if (Eqwc.settings.overWriteRasterFieldName[layer][0] == name) {
return Eqwc.settings.overWriteRasterFieldName[layer][1];
} else {
return name;
}
}

//TODO use in css!
var userLogoImg = projectData.gis_projects.path + 'admin/resources/images/user_gray.png';
6 changes: 6 additions & 0 deletions client_common/settings.template
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ Eqwc.settings.visibleFirstBaseLayer = true;
//Relevant for 2.14, since 2.18 already returns blank string
Eqwc.settings.noDataValue = '';

//overwrite identify return of raster files
//instead of Band 1 write desired value
Eqwc.settings.overWriteRasterFieldName = {};
//Eqwc.settings.overWriteRasterFieldName["layername"] = ["Band 1", "Your value"];


//use separate gisportal code to browse projects, register users and login
//code available here - https://github.com/uprel/gisportal
Eqwc.settings.useGisPortal = false;
Expand Down
8 changes: 3 additions & 5 deletions client_mobile/src/feature_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ FeatureInfo.prototype.parseResults = function(featureInfos) {
var xml = $.parseXML(featureInfos[i]);
$(xml).find('Layer').each(function() {
var features = [];
var lay = $(this).attr('name');
if ($(this).find('Feature').length > 0) {
// vector features
$(this).find('Feature').each(function() {
Expand All @@ -88,7 +89,7 @@ FeatureInfo.prototype.parseResults = function(featureInfos) {
if ($(this).attr('name') != 'geometry') {
attributes.push({
name: $(this).attr('name'),
value: $(this).attr('value')
value: $(this).attr('value').replace("NULL", Eqwc.settings.noDataValue)
});
}
});
Expand All @@ -103,7 +104,7 @@ FeatureInfo.prototype.parseResults = function(featureInfos) {
var attributes = [];
$(this).find('Attribute').each(function() {
attributes.push({
name: $(this).attr('name'),
name: getRasterFieldName(Config.getLayerName(lay), $(this).attr('name')),
value: $(this).attr('value').replace("NULL", Eqwc.settings.noDataValue)
});
});
Expand All @@ -114,9 +115,6 @@ FeatureInfo.prototype.parseResults = function(featureInfos) {
}

if (features.length > 0) {

var lay = $(this).attr('name');

results.push({
layer: Config.getLayerName(lay),
features: features
Expand Down

0 comments on commit d83b2d0

Please # to comment.