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?
    – Thomas B
    Feb 4, 2015 at 21:22
  • I use WMS layers. 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 :) 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. 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
    – Jorge Sanz
    Feb 6, 2015 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.