Query windows improved
fernao - December 21, 2005 - 19:11
| Project: | Carto - opengis web mapping |
| Version: | 4.6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | fernao |
| Status: | active |
Description
Hi there
I want to improve the query info window, to display formatted text, dynamically load a thumbnail etc.
Have anyone made something like this before?
Thanks

#1
Hi Fernao,
The present implementation of feature info display is indeed very basic: inside the mappingwidgets simplemap.js file, the feature info response is either shown as is in a window or alert box.
This can easily be changed in displaying the response in a html element on your page; for this I am adding a DocumentElement widget type at the moment.
Problem with the feature info response is that the output is not constant; different map servers can return different text. When using an xsl to format the text, it can be applied server side or client side.
What are your ideas about how to solve it?
Greetings,
John.
#2
Maybe XML + XSL could solve it.
I've found an article (Improving WMS GetFeatureInfo
#3
oops!
So, that article gives and option on displaying the GetFeatureInfo in a different way.
I still didn't understood how can I use the DocumentElement. It passes a posted form element, that's it?
#4
At the present, the DocumentElement widget is not yet available in the current mappingwidgets version. It will be in the next.
It's purpose is to serve as a destination for the feature info response. And, as you suggest, it should be possible to apply an xsl stylesheet to the response. Using this widget, you can then define a custom block that will display the feature info response.
#5
Here is a thread talking about this, also:
http://lists.eogeo.org/pipermail/wms-dev/2004-October/000602.html
#6
Hi there
After some time, I've solved my problem just with the drupal tools. The objective was to create an integration between drupal and the maps.
By navegating on the map, I click on a queryable area, that is associated with a NID (node id number).
I've associated all those NIDs in my postgis database, adding a column for it.
So, this query goes to a template page, that is, actually, a refresh page. It gets the posted values from mapserver and fills a form, resendind it to a drupal page specially created for it (called "popup"). This was the only way to get the data from mapserver.
Map
The drupal popup page has a custom php code that gets the nid from the clicked area on the map and associates it with the related node. So, I can work with images, fields and every other data of it. So, this popup now acts as another navegating tool, with photos or any other data from that node:
<?php
$nid = $_POST['nid'];
$arrNode = array();
$arrNode["nid"] = $nid;
$node = node_load($arrNode);
?>
// change Page
function changePage(nid){
defaultLoc = "http://tombados-linux/cms/node/";
window.opener.location = defaultLoc + nid;
window.self.close();
}
function back(){
window.opener.refresh(-1);
}
<?phpecho $node->name
?>
Go to node!
I hope it works for another people too!
:)
#7
(sorry for the last one, not well formatted)
Hi there
After some time, I've solved my problem just with the drupal tools. The objective was to create an integration between drupal and the maps.
By navegating on the map, I click on a queryable area, that is associated with a NID (node id number).
I've associated all those NIDs in my postgis database, adding a column for it.
So, this query goes to a template page, that is, actually, a refresh page. It gets the posted values from mapserver and fills a form, resendind it to a drupal page specially created for it (called "popup"). This was the only way to get the data from mapserver.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Map</title>
</head>
<body onload="document.forms[0].submit();">
<form action="http://tombados-linux/cms/mapa/popup" method="post">
<input type="hidden" name="nid" value="[nid]">
</form>
</body>
</html>
The drupal popup page has a custom php code that gets the nid from the clicked area on the map and associates it with the related node. So, I can work with images, fields and every other data of it. So, this popup now acts as another navegating tool, with photos or any other data from that node:
<?php
$nid = $_POST['nid'];
$arrNode = array();
$arrNode["nid"] = $nid;
$node = node_load($arrNode);
?>
<script language="javascript">
// change Page
function changePage(nid){
defaultLoc = "http://tombados-linux/cms/node/";
window.opener.location = defaultLoc + nid;
window.self.close();
}
function back(){
window.opener.refresh(-1);
}
</script>
<table>
<tr>
<td bgcolor='#006699' class='popup-title'>
<strong><?php echo $node->name ?></strong>
</td>
</tr>
<tr>
<td>
<img src="<?php echo $node->img_url; ?>">
</td>
</tr>
<tr>
<td>
<a href='javascript:void(0);changePage(<?php echo $nid ?>)';>Go to node!</a>
</td>
</tr>
</table>
</html>
I hope it works for another people too!
:)
#8
Do you perhaps have a demo available on the internet?
#9
The system in working in an intranet, for now. So, here goes some screenshots
The first one is the map. Selecting the "query" tool, a popup window is opened (passing the query values). The first page, of the query, is the "template" line in the mapfile.
I didn't have sucess in getting the values directly from the query, because of the format of template. So, I've putted this value filling a form, that would be sent to another page.
This second page is a drupal normal page, with all the blocks hidden for this type (popup, that I've created). In this page I can track the value from the query and realize an integration with drupal.
Remembering: I've added a column with the NID (node ID) in the map database. So, this NID can be retrieved and the integration could be done.
So, the user receives a popup window that calls all those information from that drupal nid (second image). In this page,I've putted a link to get directly to the node page.
#10
Screenshot 1
#11
Screenshot 2
#12
Screenshot 3