Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

Find if 2 polygons have an intersection (Geoserver)

I need to check if 2 polygons have at least one common point. What should be a proper CQL syntax for WFS request? And another variant if my 1st is not possible: get a list of polygons that have at least one common point or intersection with the source polygon?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The answers to these two questions are related. I'll answer the 2nd (easier) one first. You can test for at least a point in common using the Intersects test so a CQL filter like:

intersects(POLYGON((.....)), the_geom)

This will return all the features that intersect the geometry stored in the the_geom attribute.

To limit it to a specific feature you can extend the filter to request a specific feature such as:

in (1) and intersects(POLYGON((.....)), the_geom)

to return a feature if it's id is 1 and it intersects.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...