[Geoserver-users] CQL help? (I'm SO CLOSE!)

Hi all,

Thanks to Andrea and others, I have managed to get my non-native GetFeature call working.

Almost!

In my application, I’m using OpenLayers to composite a Google baselayer with an overlay of my own construction, served up with GeoServer 2.3. The layers in my thing are all in a Wisconsin-specific projection (EPSG:3071), and they line up nicely with the Google layer when I put it together with OpenLayers. So, as far as I know, I’ve got those data in there correctly.

What I’m trying to do is get data via GetFeature calls from lat/long coordinates, e.g. from a cell phone. So (pardon the long URL) a call that ALMOST works looks like this:

http://144.92.93.196/geoserver/wfs?service=wfs
&REQUEST=GetFeature
&typename=mmas:rf_map_0
&maxFeatures=2
&BBOX=-89.4,43.1,-89.4,43.1,EPSG:4326
&srsname=EPSG:4326

The trouble is, of course, that BBOX won’t do – it returns multiple features, any of whose bboxes overlap the given one (in this case, basically a point).

So what I need to do is use a spatial operator, and CQL seems perfect for the job. I’ve tried various stabs at using CONTAINS in the URL. I’ve figured out the syntax but have one more problem.

Here’s a query that works using CQL:

http://144.92.93.196/geoserver/wfs?service=wfs
&REQUEST=GetFeature
&typeNAME=mmas:rf_map_0
&maxFeatures=1
&srsNAME=EPSG:4326
&cql_filter=contains(the_geom,poin(579554 274543))

But the phone delivers EPSG:4326 coordinates. Can this be done à la the BBOX request above? Can GeoServer transform the SRS in a CQL query, or must I tell my poor mobile-app author that he has to find a Proj equivalent for his application platform and transform to EPSG:3071 before sending the query? Because I think I’ll get a very snippy email indeed if I recommend that course to him!

Thanks (yet again) for your help,

rw

CQL expects native coordinates. You need to convert the geometry to native coordinate system at the OL end before making the request.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

If your developer is making the request in OL then they could link in proj4js to do the reprojection on the phone.

Another option - you could wrap the GetFeatures request in a context sensitive proxy in which you perform the coordinate transformation. Writing a content proxy is easy (there are lots of servlet examples out there), just augment one of those to use GT to reproject the coordinate?

David

On Tue, Mar 19, 2013 at 2:47 PM, Phil Scadden <p.scadden@anonymised.com> wrote:

CQL expects native coordinates. You need to convert the geometry to
native coordinate system at the OL end before making the request.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.


Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users