cross layer geometry intersection

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

cross layer geometry intersection

Matt Hakim
hi all,
is it possible to write a WFS filter that intersects a subset of the geometry from one layer with a subset of the geometry from another layer? This is mainly for performance reasons. 

In the below query I am intersecting a subset of geometry over the whole base layer. Instead, can I first select a part of the base layer?

Is there any other way to increase performance of this query? I am using the area calculation as the boundaries of the geometries on the two layers do not coincide exactly, so Within, Intersection, etc give false positives.

Regards

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs"


        xmlns:fes="http://www.opengis.net/fes/2.0"

        service="WFS" version="1.0.0">

        <wfs:Query typeName="ABS_States_2016_40M">

                <wfs:PropertyName>STATE_CODE</wfs:PropertyName>

                <ogc:Filter>

                        <ogc:PropertyIsGreaterThan>

                                <ogc:Function name="area">

                                        <ogc:Function name="intersection">

                                                <ogc:PropertyName>the_geom</ogc:PropertyName>

                                                <ogc:Function name="querySingle">

                                                        <ogc:Literal>MMM_by_State</ogc:Literal>

                                                        <ogc:Literal>the_geom</ogc:Literal>

                                                        <ogc:Literal>regionCode = '77'</ogc:Literal>

                                                </ogc:Function>

                                        </ogc:Function>

                                </ogc:Function>

                                <ogc:Literal>0.001</ogc:Literal>

                        </ogc:PropertyIsGreaterThan>

                </ogc:Filter>

        </wfs:Query>

</wfs:GetFeature>


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: cross layer geometry intersection

geowolf
On Mon, Jan 21, 2019 at 11:53 PM Matt Hakim <[hidden email]> wrote:
hi all,
is it possible to write a WFS filter that intersects a subset of the geometry from one layer with a subset of the geometry from another layer? This is mainly for performance reasons. 

In the below query I am intersecting a subset of geometry over the whole base layer. Instead, can I first select a part of the base layer?

You can put another filter criteria in "and" in the ogc:Filter, assuming that your "base layer" is ABS_States_2016_40M.
The MMM_by_State is already filtered via CQL filter, but you can add more conditions in there too if necessary. 
I'm not sure I understood your question honestly, if I did not, could you clarify?

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Reply | Threaded
Open this post in threaded view
|

Re: cross layer geometry intersection

Vera Green
If your data is in PostgreSQL you can definitely do this type of query with a view on the database side (I can provide an example) .  This is the solution I am using and the performance is very good since the query occurs database side.  
When you say "subset of the geometry" is this subset based on an attribute/field filter?  If not how are you selecting the subset?
I have not tried to do this in GeoServer but it would require access to the geometry field of both layers.  Maybe someone else can comment on if the geometry fields will be accessible between layers.  For example if you have layerA and layerB.  Can you access the geometry of layerA when setting up a query on layerB?
Let me know if I am understanding your question correctly.
Vera

On Fri, Jan 25, 2019 at 3:32 AM Andrea Aime <[hidden email]> wrote:
On Mon, Jan 21, 2019 at 11:53 PM Matt Hakim <[hidden email]> wrote:
hi all,
is it possible to write a WFS filter that intersects a subset of the geometry from one layer with a subset of the geometry from another layer? This is mainly for performance reasons. 

In the below query I am intersecting a subset of geometry over the whole base layer. Instead, can I first select a part of the base layer?

You can put another filter criteria in "and" in the ogc:Filter, assuming that your "base layer" is ABS_States_2016_40M.
The MMM_by_State is already filtered via CQL filter, but you can add more conditions in there too if necessary. 
I'm not sure I understood your question honestly, if I did not, could you clarify?

Cheers
Andrea

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:
- Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users