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?

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.

  • Yea, i've tried that, didn't got what i needed. Thanks anyway :) – Stefan Mihajlovic Feb 5 '15 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?

  • 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. – Stefan Mihajlovic Feb 6 '15 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 '15 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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