0

Given 1 non-self-intersecting line (red) and 2 other non-self-intersecting lines (light-green), what is the best way to find the coordinates of the line in between the 2 intersections?

I threw this image together to better illustrate what I'm saying.

Preferably to be implemented in PHP code, does anyone have an algorithm to offer as to how to find the coordinates of the red line in between the 2 red/light-green line intersections?

Coordinates will either be in lat/lon or X/Y plane format though this shouldn't affect the algorithm.

enter image description here

1
  • stackoverflow.com/questions/385305/… seems to have something usefull , usually people do stuff like this in javascript or in database (postgis). easiest way ( that i know) would be use postgis database like this: select st_intersection(st_GeomFromText( + your_line_in_wkt +), ST_GeomFromtext(another_line_in_wkt)) to your database (assuming that you don't want to save your data into database: That would need something like 10 lines of code. Jan 15 '14 at 9:33
1

You can use the ESRI WEB API for Javascript.
1) Create the lines
https://developers.arcgis.com/en/javascript/jsapi/polyline.html
2) Use the GeometryService for the intersection
https://developers.arcgis.com/en/javascript/jsapi/geometryservice.html#intersect

GeometryService
http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer

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.