Special thanks to sir Gery for the valuable assistance he provided us.<br><br>Yours truly:<br><br>Julius<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Julius Sempio</b> <span dir="ltr"><<a href="mailto:julius.sempio@gmail.com">julius.sempio@gmail.com</a>></span><br>
Date: Tue, May 29, 2012 at 12:17 PM<br>Subject: Re: [OpenLayers-Users] Getting specific data from a single vector feature with a large attribute table<br>To: "Gery ." <<a href="mailto:gamejihou@hotmail.com">gamejihou@hotmail.com</a>><br>
<br><br>Good day sir. <img goomoji="330" style="margin:0pt 0.2ex;vertical-align:middle" src="cid:330@goomoji.gmail"><br><br>We're pretty happy to say that we finally managed to solve the issue. We made use of a ready-made drop-down box (from the free DHTMLx standard edition library) and made entries linked to the CQL_FILTER in the GetFeature. We're happy to share the solution for the reference of others:<br>

<br><span style="background-color:rgb(255,255,51)">var survno;</span> <== the repository of the survey number parameter, declared as a global variable<br><br>Snippet within our init() function:<br>var survnoOptions = [];<br>

    survnoOptions.push(["0", "Select a survey #"]);<br>    survnoOptions.push(["1", "1"]);<br>    survnoOptions.push(["2", "2"]);<br>    survnoOptions.push(["3", "3"]);<br>

    survnoOptions.push(["4", "4"]);<br>    survnoOptions.push(["5", "5"]);<br>    survnoOptions.push(["6", "6"]);<br>    survnoOptions.push(["7", "7"]);<br>

    survnoOptions.push(["8", "8"]);<br>    survnoOptions.push(["9", "9"]);<br>    survnoOptions.push(["10", "10"]);<br>    survnoOptions.push(["11", "11"]);<br>

    survnoOptions.push(["12", "12"]);<br>    <br>    survnoCombo = new dhtmlXCombo("tsncombobox", "survnosearch", 0.075*width);<br>    survnoCombo.addOption(survnoOptions);<br>    survnoCombo.selectOption(1, false, false);<br>

    survno = survnoCombo.getSelectedValue();<br>    survnoCombo.attachEvent("onChange",<br>        function(){<br>            survno = survnoCombo.getSelectedValue();<br>        });<br>    var tsncomboboxDIV = document.getElementById('tsncombobox');<br>

    <br>    var survnoPage =<br>        "<p style=\"font-family:verdana;color:navy;font-size:11px;text-align:left;width:25%\">"<br>            + "<strong>Survey #: </strong></p>";<br>

    <br>    var statusinitDIV = document.getElementById('tributaryinformationstatusinit');<br>    statusinitDIV.innerHTML = survnoPage;<br>    statusinitDIV.appendChild(tsncomboboxDIV);<div class="im"><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></div>        <span style="background-color:rgb(255,255,51)">CQL_FILTER: "wqms_id = \'" + wqms + "\' AND survey_num = " + survno};</span>  <== the modified CQL_FILTER parameter that uses the survno global variable<div class="im">
<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></div>We placed the data display in the handlerWQMS(feature) function, which is simply an "innerHTML-setting" function.<br><br>Again, thank you for the assistance and insights, good sires. <img goomoji="330" style="margin:0pt 0.2ex;vertical-align:middle" src="cid:330@goomoji.gmail"><br>

<br>Yours truly:<br><br>Julius<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Tue, May 29, 2012 at 10:55 AM, Julius Sempio <span dir="ltr"><<a href="mailto:julius.sempio@gmail.com" target="_blank">julius.sempio@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Good day sir.<br><br>While studying the idea on attaching innerHTML's in the drop-down box, we also found out that the CQL_FILTER parameter in our WFS GetFeature request can be utilized as well in outputting the row you need (as long as they have unique values):<div>

<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></div>        <span style="background-color:rgb(255,255,0)">CQL_FILTER: "wqms_id = \'" + wqms + "\'"};</span> <== can also help :D<div>

<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></div>We'll try to work around on both ideas.<br><br>Thanks for the insights given as of the moment.<br><br>Yours truly:<br><br>Julius<div>
<div><br><br><div class="gmail_quote">
On Mon, May 28, 2012 at 9:05 PM, Gery . <span dir="ltr"><<a href="mailto:gamejihou@hotmail.com" target="_blank">gamejihou@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div><div dir="ltr">
Hi Julius,<br><br>Now I understand, probably this may work: <a href="http://www.mail-archive.com/users@openlayers.org/msg04937.html" target="_blank">http://www.mail-archive.com/users@openlayers.org/msg04937.html</a>. This is an example in html: <a href="http://www.echoecho.com/htmlforms11.htm" target="_blank">http://www.echoecho.com/htmlforms11.htm</a>. It should be a way to link that to your postgis table, perhaps through your geoserver but no idea about how.<br>


<br>HTH,<br><div><br></div><div><div><div></div><hr>Date: Mon, 28 May 2012 19:33:01 +0800<br>Subject: Re: [OpenLayers-Users] Getting specific data from a single vector feature with a large attribute table<br>
From: <a href="mailto:julius.sempio@gmail.com" target="_blank">julius.sempio@gmail.com</a><br>To: <a href="mailto:gamejihou@hotmail.com" target="_blank">gamejihou@hotmail.com</a></div><div><div><br><br>Good day, sir. Thank you for the prompt reply.<br>


<br>The sample data we provided are stored in a single point vector, and in effect we can actually click on only a single vector (or, in essence, a single point vector storing multiple rows).<br>
<br>We're planning to make a drop-down box that lists the Survey Numbers and then when the end user selects a survey number (which are, by the way, our means to display data in a temporal manner - that is, each survey number has an assigned date of the times the water quality surveys were done) the information regarding water quality on that particular date is displayed.<br>



<br>We're thinking of displaying data one row at a time using that drop-down box, but right now we're still finding ways to do so. As of the moment, we were unsuccessful in linking the drop-down box to GetFeature or GetFeatureInfo.<br>



<br>We do find the information you provided helpful when it comes to overlapping features, however, so we still appreciate the insight.<br><br>Thank you for the time in considering this problem of ours.<br><br>Yours truly:<br>



<br>Julius<br><br><div>On Mon, May 28, 2012 at 6:14 PM, Gery . <span dir="ltr"><<a href="mailto:gamejihou@hotmail.com" target="_blank">gamejihou@hotmail.com</a>></span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex">






<div><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: <a href="http://openlayers.org/dev/examples/getfeatureinfo-popup.html" target="_blank">http://openlayers.org/dev/examples/getfeatureinfo-popup.html</a><span style="padding-right:16px;width:16px;min-height:16px"></span><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></div><hr>Date: Mon, 28 May 2012 17:30:05 +0800<br>From: <a href="mailto:julius.sempio@gmail.com" target="_blank">julius.sempio@gmail.com</a><br>To: <a href="mailto:openlayers-users@lists.osgeo.org" target="_blank">openlayers-users@lists.osgeo.org</a><br>



Subject: [OpenLayers-Users] Getting specific data from a single vector feature with a large attribute table<div><div><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><span style="padding-right:16px;width:16px;min-height:16px"></span>;<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></div></div>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><span style="padding-right:16px;width:16px;min-height:16px"></span></div>
                                          </div></div>
</blockquote></div><br></div></div></div>                                     </div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></div><br>