Hello Julius,

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

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.

Hope this helps,

Gery

Date: Mon, 28 May 2012 17:30:05 +0800
From: [email protected]
To: [email protected]
Subject: [OpenLayers-Users] Getting specific data from a single vector feature 
with a large attribute table

Good day, sires.

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.


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):


fid        survey_no      wqms_id            do          surveydate
135      1                   WQS-10-1         8.45       1/27/2010       ==> 
only this line gets displayed right now
136      2                   WQS-10-2         1.27       1/28/2010

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
138      4                   WQS-10-4         6.07       3/24/2010

...        ...                  ...                     ...           ...

We're currently using the following codes to get information on the feature:

function linkToWQMS(wqms){
    //clear focus layers from previous selection

    if (wqmsHoverFocus.features != null) {
        wqmsHoverFocus.removeAllFeatures();
    }
    if (popup != null){
        map.removePopup(popup);
    }
    
    //process wqmsid
    var wqmsSelected = wqms.name;

    getWQMS(wqmsSelected);
}

function getWQMS(wqms){
    var paramsWQMS = {
        REQUEST: "GetFeature",
        SERVICE: "WFS",
        VERSION: "1.1.0",
        TYPENAME: ["prism:WQMS"],

        OUTPUTFORMAT: "GML2",
        SRSNAME: "EPSG:4326",
        CQL_FILTER: "wqms_id = \'" + wqms + "\'"};
    
    OpenLayers.Request.GET({
        url: "http://202.92.159.15:8080/geoserver/prism/wfs";,

        params: paramsWQMS,
        callback: handlerWQMS});
}

function handlerWQMS(response){
    //Create gml format object
    var gml = new OpenLayers.Format.GML();
    gml.extractAttributes = true;

        
    //Get array of OpenLayers.Feature.Vector
    var features = gml.read(response.responseText);
    
    //reproject geometry before buffering
    var wqmsid = features[0].attributes["wqms_id"];

    //alert(wqmsid);
    var geom = features[0].geometry.clone();
    geom.transform(geographic, mercator);
    
    //center tributary to center of bounds
    var parcelCenter = geom.getBounds().getCenterLonLat();

    map.panTo(parcelCenter);
    
    //pass the control to prismParcelInformationUI.js
    wqmsInformationController(features[0]);
    drawFeatures ("wqms", features, 0);
}

function wqmsInformationController(feature){

    //pass to create status info entry
    setTributaryInformationStatus(feature);
}

function setTributaryInformationStatus(feature){
    //code to prepare data for viewing
    var id, survno, dopercent;

    id = feature.attributes["wqms_id"];
    survno = feature.attributes["survey_no"];
    dopercent = Math.round(feature.attributes["do"]*100)/100;
        
    var tributaryInformationStatusTablePage = "<table style=\"width:100%\">"

        + "<tr><td 
style=\"font-family:verdana;color:navy;font-size:11px;text-align:right;width:25%\"><strong>Station
 ID:</strong></td>"
        + "<td 
style=\"font-family:verdana;color:navy;font-size:11px;text-align:left\">" + id 
+ "</td></tr>"

        + "<tr><td 
style=\"font-family:verdana;color:navy;font-size:11px;text-align:right;width:25%\"><strong>Survey
 No:</strong></td>"
        + "<td 
style=\"font-family:verdana;color:navy;font-size:11px;text-align:left\">" + 
survno + "</td></tr>"

        + "<tr><td 
style=\"font-family:verdana;color:navy;font-size:11px;text-align:right;width:25%\"><strong>Dissolved
 Oxygen %:</strong></td>"
        + "<td 
style=\"font-family:verdana;color:navy;font-size:11px;text-align:left\">" + 
checkIfEmpty(dopercent) + "</td></tr>"

        + "</table>";
    
    //get html elements and attach tributaryInformationBasicPage
    
    var statustableDIV = 
document.getElementById('tributaryinformationstatustable');

    statustableDIV.innerHTML = tributaryInformationStatusTablePage;
    statusinitDIV.appendChild(statustableDIV);
    toolsStatusBar.setText("~(^.^)~ Viewing Tributary Status Information");
}

 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.

Yours truly:

Julius Sempio
Department of Geodetic Engineering
University of the Philippines


_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users                        
                  
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to