[Geoserver-devel] How to define sld with intersection of two different layers

  
Hello,

I want to know, if it is possible to define an intersection in an sld
file of two different layers.
Lets consider layer A and layer B; both are of type multipolygon

I want to render all features of layer A that intersect with features of
layer B in a different color than the other features.

Is this possible to do with the OGC Filter Encoding Specification within
an SLD file?

cheers Markus

--
Markus Innerebner

DIS Research Group - Faculty of Computer Science
Free University Bozen-Bolzano

Dominikanerplatz 3 - Room 213
I - 39100 Bozen
Phone: +39-0471-016223
Mobile: +39-333-9392929

gpg --fingerprint
-------------------------------------
pub 1024D/588F6308 2007-01-09
      Key fingerprint = 6948 947E CBD2 89FD E773 E863 914F EB1B 588F 6308
sub 2048g/BF4877D0 2007-01-09

Sorry Markus, no way to do joins (even at the style level). You can build up a style based on a literal geometry and get dynamic interaction that way - but that involves your client making
the SLD on the fly.

Integration by visualization is the rule it seems for these OGC standards; you may have some luck with transparency...
Cheers,
Jody

Markus Innerebner ha scritto:

  
Hello,

I want to know, if it is possible to define an intersection in an sld
file of two different layers.
Lets consider layer A and layer B; both are of type multipolygon

I want to render all features of layer A that intersect with features of
layer B in a different color than the other features.

Is this possible to do with the OGC Filter Encoding Specification within
an SLD file?

As Jody said, it's not possible. The usual way to deal with this limitation is to create a view in your database that does the joining,
register it against the spatial data metadata tables so that it looks
like a standard spatial table, and have GeoServer serve it.

Of course this approach has the severe limitation of being static, you
have to know in advance what kind of joins you'll need.

Cheers
Andrea

Hi

>
> I want to know, if it is possible to define an intersection in an sld
> file of two different layers.
> Lets consider layer A and layer B; both are of type multipolygon
>
> I want to render all features of layer A that intersect with features of
> layer B in a different color than the other features.
>
> Is this possible to do with the OGC Filter Encoding Specification within
> an SLD file?

As Jody said, it's not possible. The usual way to deal with this
limitation is to create a view in your database that does the joining,
register it against the spatial data metadata tables so that it looks
like a standard spatial table, and have GeoServer serve it.

Of course this approach has the severe limitation of being static, you
have to know in advance what kind of joins you'll need.

In fact.
Meanwhile I read this document of OGC and I was not able to find join
operators. My impression is, this Filter Encoding Specification is
limitated. Probably it makes more sense to use XQuery instead? As far as
I know geoserver does not support XQuery, right?

cheers Markus

Markus Innerebner ha scritto:

Hi

I want to know, if it is possible to define an intersection in an sld
file of two different layers.
Lets consider layer A and layer B; both are of type multipolygon

I want to render all features of layer A that intersect with features of
layer B in a different color than the other features.

Is this possible to do with the OGC Filter Encoding Specification within
an SLD file?

As Jody said, it's not possible. The usual way to deal with this limitation is to create a view in your database that does the joining,
register it against the spatial data metadata tables so that it looks
like a standard spatial table, and have GeoServer serve it.

Of course this approach has the severe limitation of being static, you
have to know in advance what kind of joins you'll need.

In fact. Meanwhile I read this document of OGC and I was not able to find join
operators. My impression is, this Filter Encoding Specification is
limitated. Probably it makes more sense to use XQuery instead? As far as
I know geoserver does not support XQuery, right?

No, there is no way to make joins in GeoServer. We don't support XQuery either. What you want to do is not an association handling either, so
the future complex features support won't help either.
What you're looking for falls in the spatial analisys domain, which OGC
support with the WPS (web processing service) specification, that we
don't support at the moment (there is a WPS plugin on the internet,
but what you're asking for would require some serious postgis datastore
extension as well).
The only way to handle this is what I suggested above unfortunately (if
anybody has better ideas, please share :slight_smile: )

Cheers
Andrea

On Wed, 2007-08-29 at 15:11 +0200, Andrea Aime wrote:

Hi Andrea

here is something not clear for me? Maybe I missunderstood you.

I launched now postgres with following query:

select * from censuses c, rivers r where
intersects(r.the_geom,c.the_geom)

and I am able to have results.

So I am asking me why it is not possible to define this with filter
encoding specification???

<Filter>
<Intersects>
   <TypeName="censuses" propertyName="the_geom"/>
   <TypeName="rivers" propertyName="the_geom"/>
</Intersects>
</Filter>

--
Markus Innerebner

DIS Research Group - Faculty of Computer Science
Free University Bozen-Bolzano

Dominikanerplatz 3 - Room 213
I - 39100 Bozen
Phone: +39-0471-016223
Mobile: +39-333-9392929

gpg --fingerprint
-------------------------------------
pub 1024D/588F6308 2007-01-09
      Key fingerprint = 6948 947E CBD2 89FD E773 E863 914F EB1B 588F 6308
sub 2048g/BF4877D0 2007-01-09

Markus Innerebner ha scritto:

On Wed, 2007-08-29 at 15:11 +0200, Andrea Aime wrote:

Hi Andrea

here is something not clear for me? Maybe I missunderstood you.

I launched now postgres with following query:

select * from censuses c, rivers r where
intersects(r.the_geom,c.the_geom)

and I am able to have results.

So I am asking me why it is not possible to define this with filter
encoding specification???

<Filter>
<Intersects>
   <TypeName="censuses" propertyName="the_geom"/>
   <TypeName="rivers" propertyName="the_geom"/>
</Intersects>
</Filter>

Because you're not querying tables, you're querying a feature type,
the elements of an xml schema if you want, so you're limited to whatever
attribute is in that feature type.
I am sorry, but OGC specs does not allow that, and there is nothing
I can do about it. With some sizeable funding we could develop a WPS
to solve this problem, but this is another matter I guess.

Cheers
Andrea

So as long as we have crushed your hope (sorry!) - here is how such things are supposed to happen between tables. The feature model is supposed to allow associations to other features (these would be external keys in your database...). The SLD+Filter can be used to define some constraints that use xpath to navigate these associations ... you can also navigate these associations when rendering (rendering content that is associated with the feature).

Can this be done in an add-hoc manner? Nope.

Jody

Andrea Aime wrote:

No, there is no way to make joins in GeoServer. We don't support XQuery either. What you want to do is not an association handling either, so
the future complex features support won't help either.
What you're looking for falls in the spatial analisys domain, which OGC
support with the WPS (web processing service) specification, that we
don't support at the moment (there is a WPS plugin on the internet,
but what you're asking for would require some serious postgis datastore
extension as well).
The only way to handle this is what I suggested above unfortunately (if
anybody has better ideas, please share :slight_smile: )

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
  

Markus Innerebner wrote:

<Filter>
<Intersects>
   <TypeName="censuses" propertyName="the_geom"/>
   <TypeName="rivers" propertyName="the_geom"/>
</Intersects>
</Filter>
  

They did have a syntax for this for an early WFS 1.1 - it was not quite as you described. The problem is the OGC people are "model maniacs" and the returned result does not confirm to any model (ie schema).

They did something like making an alias "A" for rivers" and "B" for censuses and then did their filter like
<Filter>
   <Intersects>
      <PropertyName>A.the_geom</PropertyName>
      <PropertyName>B.the_geom</PropertyName>
   </Intersects>
...
Although I think it may of been even more limited and only let you "join" where things were equal ...
Jody

On Wed, 2007-08-29 at 11:26 -0700, Jody Garnett wrote:

Markus Innerebner wrote:
> <Filter>
> <Intersects>
> <TypeName="censuses" propertyName="the_geom"/>
> <TypeName="rivers" propertyName="the_geom"/>
> </Intersects>
> </Filter>
>
They did have a syntax for this for an early WFS 1.1 - it was not quite
as you described. The problem is the OGC people are "model maniacs" and
the returned result does not confirm to any model (ie schema).

They did something like making an alias "A" for rivers" and "B" for
censuses and then did their filter like
<Filter>
   <Intersects>
      <PropertyName>A.the_geom</PropertyName>
      <PropertyName>B.the_geom</PropertyName>
   </Intersects>
...
Although I think it may of been even more limited and only let you
"join" where things were equal ...
Jody

Fine, I was reading it now and they explicitly say:
Cite: "Specifying more than one typename indicates that a join operation
is being performed. All the names in the typeName list must be valid
types that belong to this query's feature content as defined by the GML
Application Schema."

Then there is also written about the aliasing.

So it seem wfs 1.1.0 support the join operator

cheers

--
Markus Innerebner

DIS Research Group - Faculty of Computer Science
Free University Bozen-Bolzano

Dominikanerplatz 3 - Room 213
I - 39100 Bozen
Phone: +39-0471-016223
Mobile: +39-333-9392929

gpg --fingerprint
-------------------------------------
pub 1024D/588F6308 2007-01-09
      Key fingerprint = 6948 947E CBD2 89FD E773 E863 914F EB1B 588F 6308
sub 2048g/BF4877D0 2007-01-09

Markus Innerebner ha scritto:
...

Fine, I was reading it now and they explicitly say:
Cite: "Specifying more than one typename indicates that a join operation
is being performed. All the names in the typeName list must be valid
types that belong to this query's feature content as defined by the GML
Application Schema."

Then there is also written about the aliasing.

So it seem wfs 1.1.0 support the join operator

Hum, in fact the wfs 1.1 document has that sentence. And the wfs.xsd schema file does in fact allow for a list of elements, so this leaves
me wondering (when I joined GeoServer everybody was telling me
joining had been dropped from wfs 1.1 because it was considered too
complex).

The wfs 1.1 conformance tests does not test it either (I'm sure because
GeoServer is the wfs 1.1 reference implementation).

In any case, GeoServer does not support joining but, even
if it did, there is no way to express what you want with an intersects
clause. The filter.xsd schema is clear:

<xsd:element name="Intersects"
                 type="ogc:BinarySpatialOpType"
                 substitutionGroup="ogc:spatialOps"/>

<xsd:complexType name="BinarySpatialOpType">
   <xsd:complexContent>
      <xsd:extension base="ogc:SpatialOpsType">
         <xsd:sequence>
            <xsd:element ref="ogc:PropertyName"/>
            <xsd:choice>
               <xsd:element ref="gml:_Geometry"/>
               <xsd:element ref="gml:Envelope"/>
            </xsd:choice>
         </xsd:sequence>
      </xsd:extension>
   </xsd:complexContent>
</xsd:complexType>

The only way to specify an intersects clause is comparing a property
in a feature type against a literal, which is either an explicit
geometry or an envelope.

Cheers
Andrea