[Users] How to use OGC filters with Geoext

gbrun gbrun at myopera.com
Mon Aug 8 08:52:23 CEST 2011


I can't help you for the proxy issue but I can explain you how I proceed  
for the OGC filter (thanks to Phil Scadden) and the GridPanel. I did it  
few days ago.

First, you define a classic WFS protocol, without OGC filter. Then, you  
create a draw handler that allows the user to draw a polygon in the map  
for example. This draw control is inside a selection control. Then, you  
apply the WFS protocol and the OGC filter to this control:

	polygonSelectControl.events.register("featureadded", this, function (e) {
		WFSprotocol.read({
			filter: new OpenLayers.Filter.Spatial({
				type: OpenLayers.Filter.Spatial.INTERSECTS,
				distance: 1,
				distanceUnits: "meters",
				value: e.feature.geometry
			}),
			callback: processSpatialQuery
			//scope: strategy
		});
	});

Then, in the callback function, you can store the WFS response in a  
featureStore:

	function processSpatialQuery(response){
		var feat = response.features;
		featureStore.loadData(feat);	
	}

Finally, this featureStore is used by a classic GridPanel.

If you don't need a draw tool, I think you can directly add the OGC filter  
in the WFS protocol definition.

Geoffrey



On Sun, 07 Aug 2011 07:20:54 +0200, Adam Ratcliffe <adam at prema.co.nz>  
wrote:

> You can create a server-side proxy, hosted on the same domain as your
> web app.  OpenLayers comes with a CGI script that you can install for
> this purpose.  Read more here:
> http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost
>
> Cheer
>
> On Sat, Aug 6, 2011 at 3:41 AM, Surendran Neelakantan
> <surendrankn at gmail.com> wrote:
>>
>> Hi
>>
>> I would like to know the best way to use OGC WFS filters with GeoEXT. I
>> want  to query a WFS server and get the response data in GML format in a
>> grid. a sample query look like  following.
>>
>> http://SDMDataAccess.nrcs.usda.gov/Spatial/SDMNAD83UTM.wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature
>> &TYPENAME=MapunitPoly&FILTER=<Filter><BBOX><PropertyName>Geometry</PropertyName>
>> <Box srsName='EPSG:4236'><coordinates>-121.77100,37.368402
>> -121.76000,37.373473</coordinates>
>> </Box></BBOX></Filter>&SRSNAME=EPSG:26910&OUTPUTFORMAT=GML2
>>
>>
>> How do I overcome  the same origin policy  when creating a data store  
>> with
>> the above query.?
>>
>> It would be great if somebody can show me a working example with the  
>> above
>> query.
>>
>> Thank you
>>
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Users mailing list