[Geoserver-users] Passing a complex polygon to a cql filter

Hi all,

Maybe not a real geoserver question but I want to know the options I have to do the following:

I want to create a cql filter to find all features within a 10 kilometer boundary around a region (sort of province or state)

The region exists of so many points that its not possible to put it in the request url.

Option 1: use the bbox of the region. Problem is that the bbox is along x and y axes so its too big to be accurate

Option 2: use the center of the bbox. Problem is that sometimes the distance between this point and the boundary of the region is larger then 10 kilometers

I’m using a Oracle 10g Spatial database. So what options do I have more.

Can I for example calculate a polygon that covers all of the region but consisting of say 10 points max

Or do I have any other options than these

Any help is much appreciated

Cheers

Kris Geusebroek

Consultant



cid:image001.jpg@anonymised.com



Email: kgeusebroek@anonymised.com



Tel: +31 (0)35 538 1921



Fax: +31 (0)35 538 1922



Mobile: +31 (0)6 30 697 223



http://www.xebia.com







Utrechtseweg 49



1213 TL Hilversum



The Netherlands

Xebia Blog ! http://blog.xebia.com/

Xebia Podcast! http://podcast.xebia.com/

Hi Kris,

A couple of more options:

3) Submit the request as a form encoded POST (setting the 'Content-type' header to "application/x-www-form-urlencoded"). This should remove the length restriction on the filter.

4) Use OGC filter in a regular XML POST.

-Justin

Kris Geusebroek wrote:

Hi all,

Maybe not a real geoserver question but I want to know the options I have to do the following:

I want to create a cql filter to find all features within a 10 kilometer boundary around a region (sort of province or state)

The region exists of so many points that its not possible to put it in the request url.

Option 1: use the bbox of the region. Problem is that the bbox is along x and y axes so its too big to be accurate

Option 2: use the center of the bbox. Problem is that sometimes the distance between this point and the boundary of the region is larger then 10 kilometers

I’m using a Oracle 10g Spatial database. So what options do I have more.

Can I for example calculate a polygon that covers all of the region but consisting of say 10 points max

Or do I have any other options than these

Any help is much appreciated

Cheers

*Kris Geusebroek***

Consultant

* *

cid:image001.jpg@anonymised.com

Email: kgeusebroek@anonymised.com <mailto:kgeusebroek@anonymised.com>__

Tel: +31 (0)35 538 1921

Fax: +31 (0)35 538 1922

Mobile: +31 (0)6 30 697 223

http://www.xebia.com <http://www.xebia.fr/&gt;

Utrechtseweg 49

1213 TL Hilversum

The Netherlands

*Xebia Blog !* http://blog.xebia.com/

*Xebia Podcast!* http://podcast.xebia.com/

------------------------------------------------------------------------

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com

------------------------------------------------------------------------

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

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Justin Deoliveira ha scritto:

Hi Kris,

A couple of more options:

3) Submit the request as a form encoded POST (setting the 'Content-type' header to "application/x-www-form-urlencoded"). This should remove the length restriction on the filter.

One more bit. If the polygon is seriously big and you're using the
Oracle "classic" datatore you'll get an exception from the database
stating one argument is too big: Oracle cannot accept function params
that are longer than 2000 chars, and if the text version of the
geometry goes beyond that, boom!
Solution: use the Oracle NG driver, which uses prepared statements
and completely avoids the issue.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi,

We're using the oracle NG datastore already so no problem there.
I'm just looking for a way to simplify my polygons for this filtering.
I hope there is some spatial function in oracle (or postgis) to create a
new polygon out of the original one which covers the original (like
bbox) but is more close to the original as a bbox is.

Cheers Kris

-----Original Message-----
From: Andrea Aime [mailto:aaime@anonymised.com]
Sent: Tuesday, March 17, 2009 10:49 AM
To: Justin Deoliveira
Cc: Kris Geusebroek; geoserver-users
Subject: Re: [Geoserver-users] Passing a complex polygon to a cql filter

Justin Deoliveira ha scritto:

Hi Kris,

A couple of more options:

3) Submit the request as a form encoded POST (setting the

'Content-type'

header to "application/x-www-form-urlencoded"). This should remove the

length restriction on the filter.

One more bit. If the polygon is seriously big and you're using the
Oracle "classic" datatore you'll get an exception from the database
stating one argument is too big: Oracle cannot accept function params
that are longer than 2000 chars, and if the text version of the
geometry goes beyond that, boom!
Solution: use the Oracle NG driver, which uses prepared statements
and completely avoids the issue.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Kris Geusebroek ha scritto:

Hi,

We're using the oracle NG datastore already so no problem there.
I'm just looking for a way to simplify my polygons for this filtering.
I hope there is some spatial function in oracle (or postgis) to create a
new polygon out of the original one which covers the original (like
bbox) but is more close to the original as a bbox is.

It seems you're looking for a "convex hull" function. But we have
no hooks in the database code to actually use one.
We have a convexHull filter function that you could use it CQL,
but the datastore code is not smart enough to realize
the function is working against a literal and, not knowing how
to encode it in SQL, it will run the whole spatial filter in memory.
So if you want that to work fast, you'll have to compute the
convex hull in the client. This page shows an example in javascript:
http://www.geocodezip.com/map-markers_ConvexHull_Polygon.asp

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.