<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<br>Hello Julius,<br><br>I work with PostGis, Mapserver and Openlayers to plot my data. My tables are quite similar to what you have, but my code is different. If I understand well, you're trying to get the info stored in your tables after clicking each feature, is it that? if so, you have to play with the GetFeatureInfo code, here is the code: http://openlayers.org/dev/examples/getfeatureinfo-popup.html<br><br>I understand also that you want to display all the rows in your table based on survey_no column, but just clicking one feature (this is one row), is it that? as far as I know you can assign info to one feature, this is one row, and then press each feature to get its corresponding info, I know that in that way works, probably you may make a query and select only the features that match certain pattern in your survey_no column, ie. all of them that are multiple of 10.<br><br>Hope this helps,<br><br>Gery<br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Date: Mon, 28 May 2012 17:30:05 +0800<br>From: julius.sempio@gmail.com<br>To: openlayers-users@lists.osgeo.org<br>Subject: [OpenLayers-Users] Getting specific data from a single vector feature with a large attribute table<br><br>Good day, sires.<br><br>I am currently working on a web-based GIS project that mainly concerns with the extraction of data for viewing purposes, and we're using PostGIS, Geoserver and OpenLayers for the said project.<br>
<br>Right now we're trying to display data from several rows in the attribute table in a single vector, but right now we're pretty much stuck at displaying only the first line of the table (see example below):<br>
<br>fid        survey_no      wqms_id            do          surveydate<br>135      1                   WQS-10-1         8.45       1/27/2010       ==> only this line gets displayed right now<br>136      2                   WQS-10-2         1.27       1/28/2010<br>
137      3                   WQS-10-3         1.08       2/24/2010        ==> we would like to display this (and others) using survey_no as the parameter to do so<br>138      4                   WQS-10-4         6.07       3/24/2010<br>
...        ...                  ...                     ...           ...<br><br>We're currently using the following codes to get information on the feature:<br><br>function linkToWQMS(wqms){<br>    //clear focus layers from previous selection<br>
    if (wqmsHoverFocus.features != null) {<br>        wqmsHoverFocus.removeAllFeatures();<br>    }<br>    if (popup != null){<br>        map.removePopup(popup);<br>    }<br>    <br>    //process wqmsid<br>    var wqmsSelected = <a href="http://wqms.name" target="_blank">wqms.name</a>;<br>
    getWQMS(wqmsSelected);<br>}<br><br>function getWQMS(wqms){<br>    var paramsWQMS = {<br>        REQUEST: "GetFeature",<br>        SERVICE: "WFS",<br>        VERSION: "1.1.0",<br>        TYPENAME: ["prism:WQMS"],<br>
        OUTPUTFORMAT: "GML2",<br>        SRSNAME: "EPSG:4326",<br>        CQL_FILTER: "wqms_id = \'" + wqms + "\'"};<br>    <br>    OpenLayers.Request.GET({<br>        url: "<a href="http://202.92.159.15:8080/geoserver/prism/wfs" target="_blank">http://202.92.159.15:8080/geoserver/prism/wfs</a>",<br>
        params: paramsWQMS,<br>        callback: handlerWQMS});<br>}<br><br>function handlerWQMS(response){<br>    //Create gml format object<br>    var gml = new OpenLayers.Format.GML();<br>    gml.extractAttributes = true;<br>
        <br>    //Get array of OpenLayers.Feature.Vector<br>    var features = gml.read(response.responseText);<br>    <br>    //reproject geometry before buffering<br>    var wqmsid = features[0].attributes["wqms_id"];<br>
    //alert(wqmsid);<br>    var geom = features[0].geometry.clone();<br>    geom.transform(geographic, mercator);<br>    <br>    //center tributary to center of bounds<br>    var parcelCenter = geom.getBounds().getCenterLonLat();<br>
    map.panTo(parcelCenter);<br>    <br>    //pass the control to prismParcelInformationUI.js<br>    wqmsInformationController(features[0]);<br>    drawFeatures ("wqms", features, 0);<br>}<br><br>function wqmsInformationController(feature){<br>
    //pass to create status info entry<br>    setTributaryInformationStatus(feature);<br>}<br><br>function setTributaryInformationStatus(feature){<br>    //code to prepare data for viewing<br>    var id, survno, dopercent;<br>
    id = feature.attributes["wqms_id"];<br>    survno = feature.attributes["survey_no"];<br>    dopercent = Math.round(feature.attributes["do"]*100)/100;<br>        <br>    var tributaryInformationStatusTablePage = "<table style=\"width:100%\">"<br>
        + "<tr><td style=\"font-family:verdana;color:navy;font-size:11px;text-align:right;width:25%\"><strong>Station ID:</strong></td>"<br>        + "<td style=\"font-family:verdana;color:navy;font-size:11px;text-align:left\">" + id + "</td></tr>"<br>
        + "<tr><td style=\"font-family:verdana;color:navy;font-size:11px;text-align:right;width:25%\"><strong>Survey No:</strong></td>"<br>        + "<td style=\"font-family:verdana;color:navy;font-size:11px;text-align:left\">" + survno + "</td></tr>"<br>
        + "<tr><td style=\"font-family:verdana;color:navy;font-size:11px;text-align:right;width:25%\"><strong>Dissolved Oxygen %:</strong></td>"<br>        + "<td style=\"font-family:verdana;color:navy;font-size:11px;text-align:left\">" + checkIfEmpty(dopercent) + "</td></tr>"<br>
        + "</table>";<br>    <br>    //get html elements and attach tributaryInformationBasicPage<br>    <br>    var statustableDIV = document.getElementById('tributaryinformationstatustable');<br>
    statustableDIV.innerHTML = tributaryInformationStatusTablePage;<br>    statusinitDIV.appendChild(statustableDIV);<br>    toolsStatusBar.setText("~(^.^)~ Viewing Tributary Status Information");<br>}<br><br> We've been surfing a lot of Internet sources the past weeks in trying 
to find the answer, but as of the moment we have found no success. So any enlightening insights would be most welcome.<br><br>Yours truly:<br><br>Julius Sempio<br>Department of Geodetic Engineering<br>University of the Philippines<br>
<br>_______________________________________________
Users mailing list
Users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users</div>                                      </div></body>
</html>