[Geoserver-users] centroid function in wfs filter

Could someone please tell me how to combine the centroid function with a bbox
in a wfs filter?

I have the following filter
<ogc:Filter xmlns:ogc="http://ogc.org"
xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml&quot;&gt;
<gml:coordinates>137.14387351226586,35.47395210045979,137.14387351226586,35.47395210045979</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>

and I want to get the centroid of each feature returned.

I've tried adding the following

<ogc:Function
name="centroid"><ogc:PropertyName>the_geom</ogc:PropertyName></ogc:Function>

but without success.

Cheers,

Donal
--
View this message in context: http://www.nabble.com/centroid-function-in-wfs-filter-tf3465449.html#a9668653
Sent from the GeoServer - User mailing list archive at Nabble.com.

Donal ha scritto:

Could someone please tell me how to combine the centroid function with a bbox
in a wfs filter?

I have the following filter
<ogc:Filter xmlns:ogc="http://ogc.org"
xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml&quot;&gt;
<gml:coordinates>137.14387351226586,35.47395210045979,137.14387351226586,35.47395210045979</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>

and I want to get the centroid of each feature returned.

I've tried adding the following

<ogc:Function
name="centroid"><ogc:PropertyName>the_geom</ogc:PropertyName></ogc:Function>

but without success.

Hum, a filter is just a selection mean, it won't make the GetFeature return a processed result such as the centroid of a polygon.
What you're looking for seems to be WPS (Web Processing Service), but
we don't ship with one at the moment, thought there are some attempts
to provide a WPS plugin for Geoserver (none is really release quality
afaik, but I may be wrong).

Cheers
Andrea

aaime wrote:

Donal ha scritto:

Could someone please tell me how to combine the centroid function with a
bbox
in a wfs filter?

I have the following filter
<ogc:Filter xmlns:ogc="http://ogc.org"
xmlns:gml="http://www.opengis.net/gml&quot;&gt;
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml&quot;&gt;
<gml:coordinates>137.14387351226586,35.47395210045979,137.14387351226586,35.47395210045979</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>

and I want to get the centroid of each feature returned.

I've tried adding the following

<ogc:Function
name="centroid"><ogc:PropertyName>the_geom</ogc:PropertyName></ogc:Function>

but without success.

Hum, a filter is just a selection mean, it won't make the GetFeature
return a processed result such as the centroid of a polygon.
What you're looking for seems to be WPS (Web Processing Service), but
we don't ship with one at the moment, thought there are some attempts
to provide a WPS plugin for Geoserver (none is really release quality
afaik, but I may be wrong).

Cheers
Andrea

Thanks for your reply.

So is there no way of expressing "SELECT centroid(the_geom) FROM myTable"
in a WFS or WMS request? I can only do "SELECT the_geom FROM myTable WHERE
centroid(the_geom) = whatever"? Is this right?

Cheers,

Donal

--
View this message in context: http://www.nabble.com/centroid-function-in-wfs-filter-tf3465449.html#a9685919
Sent from the GeoServer - User mailing list archive at Nabble.com.

Donal ha scritto:

Thanks for your reply.

So is there no way of expressing "SELECT centroid(the_geom) FROM myTable" in a WFS or WMS request? I can only do "SELECT the_geom FROM myTable WHERE
centroid(the_geom) = whatever"? Is this right?

In WFS no, there's no way to select something other than the actual properties. This is the job of WPS, which unfortunately we don't support at the moment.

In WMS, yes, you can do that instead, in particular, you can have your
styling depend on whatever complex expression you want, so if you want to label exactly the centroid, you can use the centroid function to
extract it.

Cheers
Andrea

Hi Donal,

It sounds like you are using postgis?

As Andrea states there is no way in WFS to ask for the centroid of a property. What you could so is create a view of your table in the database which pre calculates the centroid storing it as a regular property.

CREATE VIEW myview as SELECT centroid(the_geom) as "the_geom" from myTable

You would then have to manually insert an entry into the "geometry_columns" table for the view.

I am not sure if this is an acceptable solution for you, but just thougth I would suggest it.

So is there no way of expressing "SELECT centroid(the_geom) FROM myTable" in a WFS or WMS request? I can only do "SELECT the_geom FROM myTable WHERE
centroid(the_geom) = whatever"? Is this right?

Cheers,

Donal

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Justin Deoliveira-4 wrote:

Hi Donal,

It sounds like you are using postgis?

As Andrea states there is no way in WFS to ask for the centroid of a
property. What you could so is create a view of your table in the
database which pre calculates the centroid storing it as a regular
property.

CREATE VIEW myview as SELECT centroid(the_geom) as "the_geom" from myTable

You would then have to manually insert an entry into the
"geometry_columns" table for the view.

I am not sure if this is an acceptable solution for you, but just
thougth I would suggest it.

So is there no way of expressing "SELECT centroid(the_geom) FROM
myTable"
in a WFS or WMS request? I can only do "SELECT the_geom FROM myTable
WHERE
centroid(the_geom) = whatever"? Is this right?

Cheers,

Donal

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Thanks for the suggestion. I spotted that alright in the documentation,but
unfortunately it's a non-starter for what I'm doing here.

--
View this message in context: http://www.nabble.com/centroid-function-in-wfs-filter-tf3465449.html#a9704039
Sent from the GeoServer - User mailing list archive at Nabble.com.