<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'>
<font style="font-size:10pt;" color="#366092" face="Arial" size="2"><br>Thanks a lot Bart for the message, it really looks cool, I'll take a look at it, <br><br>Best regards,<br><br>Gery<br id="FontBreak"></font><br><br><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br>__________________________________________________________________________________________<br>Piensa en el medio ambie<font style="" face="Arial">nte - mantenlo en la pantalla. NO lo imprimas si NO es necesario.</font></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2">Think green - keep it on the screen. Do NOT print if it is NOT necessary.</font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><span id="ecxresult_box" class="ecxshort_text" lang="de"><span class="ecxhps">Denken Sie an</span> <span class="ecxhps">die Umwelt</span></span></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><span id="ecxresult_box" lang="de"><span class="ecxhps"></span> <span class="ecxhps">-</span> <span class="ecxhps">bewahren Sie es</span> <span class="ecxhps">auf dem Bildschirm.</span> <span class="ecxhps">Drucken Sie NICHT</span><span>, wenn</span> <span class="ecxhps">es NICHT notwendig ist</span><span>.</span></span></font><br><br><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Subject: Re: [OpenLayers-Users] getting GeoJSON features in my search<br>From: bartvde@opengeo.org<br>Date: Thu, 27 Sep 2012 17:00:51 +0200<br>CC: openlayers-users@lists.osgeo.org<br>To: gamejihou@hotmail.com<br><br>Maybe this well help you:<div><br></div><div><a href="http://dev.geoext.org/geoext/trunk/geoext/examples/geocoder-geonames.html" target="_blank">http://dev.geoext.org/geoext/trunk/geoext/examples/geocoder-geonames.html</a></div><div><br></div><div>Best regards,</div><div>Bart</div><div><br><div>
<span class="ecxApple-style-span" style="border-collapse:separate;border-spacing:0px"><div>-- <br>Bart van den Eijnden<br>OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org</a><br>Expert service straight from the developers.</div><div><br></div></span><br class="ecxApple-interchange-newline">
</div>
<br><div><div>On Sep 27, 2012, at 4:49 PM, Gery . <<a href="mailto:gamejihou@hotmail.com">gamejihou@hotmail.com</a>> wrote:</div><br class="ecxApple-interchange-newline"><blockquote><div class="ecxhmmessage" style="font-size:10pt;font-family:Tahoma;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;orphans:2;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px"><div dir="ltr"><font style="font-size:10pt" color="#366092" face="Arial" size="2"><br>Hello, after several days checking on google I've found no examples to keep working on this, I'd appreciate if someone could point me to some examples, the problem is basically that the whole GeoJSON output is passed to OL no matter what I write in the search button, I don't get that part, I'd appreciate some support on this, thank you.<br id="ecxFontBreak"></font><br><br><br><div><div id="ecxSkyDrivePlaceholder"></div><hr id="ecxstopSpelling">From:<span class="ecxApple-converted-space"> </span><a href="mailto:gamejihou@hotmail.com">gamejihou@hotmail.com</a><br>To:<span class="ecxApple-converted-space"> </span><a href="mailto:openlayers-users@lists.osgeo.org">openlayers-users@lists.osgeo.org</a><br>Subject: getting GeoJSON features in my search<br>Date: Tue, 25 Sep 2012 22:32:12 +0000<br><br><div dir="ltr"><div dir="ltr"><font style="font-size:10pt" color="#366092" face="Arial" size="2"><br id="ecxFontBreak"></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2">After googleing for a while and reading the OL documentation, I don't understand well how the filterToParams in OpenLayers.HTTP protocol should work, what I'm trying to do is to get the GeoJSON features that matches my search using the following code:<br><br>[code]<br>Ext.onReady(function() {<br> var map = new OpenLayers.Map();<br> var osm = new OpenLayers.Layer.OSM(<br> "OSM"<br> );<br> map.addLayer(osm);<br><br> var mappanel = new GeoExt.MapPanel({<br> region:"center",<br> height: 400,<br> width: 600,<br> map: map,<br> title: 'A Simple GeoExt Map'<br> });<br><br> var layerList = new GeoExt.tree.LayerContainer({<br> text: 'All Layers',<br> layerStore: mappanel.layers,<br> leaf: false,<br> expanded: true<br> });<br><br> var layerTree = new Ext.tree.TreePanel({<br> title: 'Map Layers',<br> maxWidth: 500,<br> region: "east",<br> collapsible: true,<br> collapsed: true,<br> root: layerList<br> });<br><br> var features = [];<br> var vecLayer = new OpenLayers.Layer.Vector("Results");<br> var select = new GeoExt.grid.FeatureSelectionModel();<br><br> // define the data source<br> var protocol = new OpenLayers.Protocol.HTTP({<br> url: '<a href="http://localhost/postgis_geojson.php?geotable=boreholes_point_wgs84&geomfield=geom%27" target="_blank">http://localhost/postgis_geojson.php?geotable=boreholes_point_wgs84&geomfield=geom'</a>,<br>/* params: {<br> outputFormat: "json"<br> },<br> filterToParams: function (filter, params) {<br> if (filter.type === name)<br> return params;<br> },*/<br> format: new OpenLayers.Format.GeoJSON({<br> ignoreExtraDims: true,<br> 'internalProjection': new OpenLayers.Projection("EPSG:900913"),<br> 'externalProjection': new OpenLayers.Projection("EPSG:4326")<br> })<br> });<br>/* protocol.read({<br> callback: function(r){<br> console.log("received featured: " + r.features);<br> }<br> });*/<br><br> formPanel = new GeoExt.form.FormPanel({<br> title: "Place Name Search",<br> height: 150,<br> region: "north",<br> protocol: protocol,<br> items: [{<br> xtype: "textfield",<br> width: 200,<br> name: "station__like",<br> fieldLabel: "station <br />(use * and . for wildcards)",<br> allowBlank: false,<br> minLength: 1<br> }],<br> listeners: {<br> actioncomplete: function(form, action) {<br> features = action.response.features;<br> store.loadData(features);<br> vm=map.getLayersByName("Results");<br> if(vm.length===0){<br> vecLayer = new OpenLayers.Layer.Vector("Results");<br> map.addLayer(vecLayer);<br> store.bind(vecLayer);<br> select.bind(vecLayer);<br> }<br> }<br> },<br> buttons: [{text: 'search',<br> handler: function(){<br> formPanel.search();<br> }<br> }],<br> keys: [{ key: [Ext.EventObject.ENTER],<span class="ecxApple-converted-space"> </span><br> handler: function() {<br> formPanel.search();<br> }<br> }]<br> });<br> <span class="ecxApple-converted-space"> </span><br> var cols = [ {name: 'station', type: 'string'},<br> {name: 'survey', type: 'string'},<br> {name: 'type', type: 'string'},<br> {name: 'w_depth_m', type: 'float'},<br> {name: 'comments', type: 'string'},<br> {name: 'latitude', type: 'float'},<br> {name: 'longitude', type: 'float'}<br> ];<br><br> var reader = new GeoExt.data.FeatureReader({},cols);<br><br> var store = new GeoExt.data.FeatureStore({<br> reader: reader,<br> fields: cols,<br> autoLoad: false<br> });<br> // create grid panel configured with feature store<br> gridPanel = new Ext.grid.GridPanel({<br> title: "Results",<br> height: 500,<br> region:"center",<br> store: store,<br> columns: [{<br> header: "Station",<br> width: 100,<br> sortable: true,<br> dataIndex: "station"<br> }, {<br> header: "Survey",<br> width: 40,<br> sortable: true,<br> dataIndex: "survey"<br> }, {<br> header: "Type",<br> width: 40,<br> sortable: true,<br> dataIndex: "type"<br> }, {<br> header: "Water depth [m]",<br> width: 40,<br> sortable: true,<br> dataIndex: "w_depth_m"<br> }, {<br> header: "Comments",<br> width: 100,<br> align: 'right',<br> sortable: true,<br> dataIndex: "comments"<br> }],<br> sm: select<br> });<br><br> gridPanel.on('rowdblclick', function(g,rowIdx,r){<br> rec = store.getAt(rowIdx);<br> map.setCenter(<br> new OpenLayers.LonLat(<br> rec.get('longitude'),<br> rec.get('latitude')),<br> 10);<br> });<br><br> searchPanel = new Ext.Panel({<br> layout: "border",<br> region: "west",<br> collapsible: true,<br> width: 400,<br> items: [formPanel,gridPanel]<br> });<br> mainPanel = new Ext.Panel({<br> height: 600,<br> renderTo: "mainpanel",<br> <font color="#0070C0"> <font color="#366092"><span class="ecxApple-converted-space"> </span>layout: "border",</font></font><font color="#366092"><br></font><font color="#366092"> item</font><font color="#366092">s: [searchPanel,mappanel,layerTree]</font><font color="#366092"><br></font><font color="#366092"> });</font><font color="#366092"><br></font><font color="#366092"><br></font><font color="#366092">});</font><font color="#366092"><br></font><font color="#366092">[/code]</font><font color="#366092"><br></font><font color="#366092"><br></font><font color="#366092">thanks to Eric Lemoine I understand that the PHP script I'm using for the postgis request (</font></font><font color="#366092" face="Arial">update<span class="ecxApple-converted-space"> </span></font><font color="#366092" face="Arial"><a href="https://gist.github.com/3763701" rel="nofollow" target="_blank">https://gist.github.com/3763701</a></font><font color="#366092" face="Arial">)</font><font color="#366092" face="Arial">, should</font><font color="#366092" face="Arial"><span class="ecxApple-converted-space"> </span>allow filtering the features I'm looking for (ie.WHERE ... LIKE ...). This script has a "parameters" option that should give this but so far it only throws an error.<br><br>Sorry for probably this very simple question but I'm just starting using GeoJSON and protocol.HTTP, I'd appreciate your support, thanks,<br><br>Gery<br></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><font color="#366092"><br></font><font color="#366092"><br></font><font color="#366092"><br></font><font color="#366092">_______</font><font color="#366092">___________________________________________________________________________________</font><br>Piensa en el medio ambie<font face="Arial">nte - mantenlo en la pantalla. NO lo imprimas si NO es necesario.</font></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2">Think green - keep it on the screen. Do NOT print if it is NOT necessary.</font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><br></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><span id="ecxresult_box" class="ecxshort_text" lang="de"><span class="ecxhps">Denken Sie an</span><span class="ecxApple-converted-space"> </span><span class="ecxhps">die Umwelt</span></span></font><font style="font-size:10pt" color="#1F497D" face="Arial" size="2"><span id="ecxresult_box" lang="de"><span class="ecxhps"></span> <span class="ecxhps">-</span><span class="ecxApple-converted-space"> </span><span class="ecxhps">bewahren Sie es</span><span class="ecxApple-converted-space"> </span><span class="ecxhps">auf dem Bildschirm.</span><span class="ecxApple-converted-space"> </span><span class="ecxhps">Drucken Sie NICHT</span><span>, wenn</span><span class="ecxApple-converted-space"> </span><span class="ecxhps">es NICHT notwendig ist</span><span>.</span></span></font><br></div></div></div></div>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br></div></blockquote></div><br></div></div> </div></body>
</html>