0

I have 2 layers in OpenLayers: first is parcel layer (polygons) and second is railway layer (lines). They are already drawn and all I need to do is when I click on some line, to get intersection of that line and all polygons that are intersected with selected line and get feature info of polygons. How can I do that?

2
  • Do you use WMS or WFS-Layers? Commented Feb 4, 2015 at 21:22
  • I use WMS layers. Commented Feb 5, 2015 at 8:23

2 Answers 2

1

The getFeatureInfo should work, asking for both layers you'll get all the features that intersects the requested pixel. If you receive features from both layers then that's your success condition. It's not perfect because is based on pixel area, not an exact position, but only with WMS that's all you got.

1
  • Yea, i've tried that, didn't got what i needed. Thanks anyway :) Commented Feb 5, 2015 at 12:23
1

One option would be to use PHP if your Data is stored in a PostGIS-Database. You could register a click-event, post the click-coordinates to your php and use this coordinate to check for ST_Intersects to get back the feature attributes. would this be an option for you?

2
  • Well, I use Java as back-end, and my data is stored in Geoserver-Database. Tried with geoserver demo requests, couldn't do a thing. Commented Feb 6, 2015 at 9:51
  • out of standards (likely) you can try to write a GeoServer process to do the jobb, then use it directly or through WPS Commented Feb 6, 2015 at 13:24

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.