CQL and distance unit names

4 messages Options
Embed this post
Permalink
mbedward

CQL and distance unit names

Reply Threaded More More options
Print post
Permalink
Hello,

I've been trying to use CQL to make a DWITHIN filter like this...

DirectPosition2D pos = ...
double distance = ...
Unit<?> unit = featureType.getCoordinateReferenceSystem().getCoordinateSystem().getAxis(0).getUnit();
String unitName = unit.toString();

String filterString = String.format("DWITHIN( "the_geom", POINT(%f
%f), %s, %s)", pos.x, pos.y, distance, unitName);
Filter filter = CQL.toFilter(filterString);

But I run into trouble when CQL tries to parse the filter string and
doesn't recognize common unit names such as "m" for metre / meter.

Am I missing something ?

cheers
Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: CQL and distance unit names

Reply Threaded More More options
Print post
Permalink
PS. I also meant to say I can create the filter using FilterFactory2
with a unit name like "m" but I'd rather use CQL because the code is
for an example and CQL is less intimidating for new users.

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Mauricio Pazos

Re: CQL and distance unit names

Reply Threaded More More options
Print post
Permalink
In reply to this post by mbedward
On Thursday 24 September 2009 09:12:03 am Michael Bedward wrote:

> Hello,
>
> I've been trying to use CQL to make a DWITHIN filter like this...
>
> DirectPosition2D pos = ...
> double distance = ...
> Unit<?> unit =
> featureType.getCoordinateReferenceSystem().getCoordinateSystem().getAxis(0)
>.getUnit(); String unitName = unit.toString();
>
> String filterString = String.format("DWITHIN( "the_geom", POINT(%f
> %f), %s, %s)", pos.x, pos.y, distance, unitName);
> Filter filter = CQL.toFilter(filterString);
>
> But I run into trouble when CQL tries to parse the filter string and
> doesn't recognize common unit names such as "m" for metre / meter.
CQL implements OGC Catalogue Services Specification. The BNF for units is

<distance units> ::= = "feet" | "meters" | "statute miles" | "nautical miles"
| "kilometers"

But, in that specification you can read the following comment:

"this set of units is just an example. The real list of distance unit
must be developed"
>
> Am I missing something ?
Probably  the real list of units is defined now. I am going to review the OGC
specifications in order to update the unit list. I will add the issue as CQL
improvement.
>
> cheers
> Michael
Well, right now you should use "meters".

cheers

>
> ---------------------------------------------------------------------------
>--- Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Geotools-gt2-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

--
Mauricio Pazos
www.axios.es

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: CQL and distance unit names

Reply Threaded More More options
Print post
Permalink
Thanks for the speedy reply Mauricio

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users