0

I have got a series of UTM coordinates and azimuths like that:

Point one: Z23, 603484.00m E,7781714.00m S, Azimuth 222° Point two: Z23, 600593.00m E,7781310.00m S, Azimuth 137°

Those azimuths (should) cross in someplace. I'd like to get this crossing point coordinates.

Is it possible to do that using GeoPandas? If I don't, how can I get this using another Python tool?

  • Why do you think that they should cross in some place? – Gabriel De Luca Jun 30 at 2:33
  • Because it is a faraway place that two people are seeing simultaneously from towers. The coordinates are the tower places and the azimuths the direction of the place. So they will always cross. – Mauro Assis Jun 30 at 19:39
1

You can simply use shapely and trigonometry for that but you need a distance (GeoPandas uses shapely)

from shapely.geometry import Point, LineString
import numpy as np

# trigonometry
def cosdir(azim):
    az = np.radians(azim)
    cosa = np.sin(az)
    cosb = np.cos(az)
    return cosa,cosb
point1 = Point(603484.00,781714.00)
az1 = 137
cosa1, cosb1  = cosdir(az1)
point2 = Point( 600593.00,7781310.00)
az2 =  222
cosa2, cosb2  = cosdir(az2)
# distance 
# distance between the 2 points in meters
print(point1.distance(point2))
6999596.597025932
# create a line in the direction of azimuth
length = 10000
endline1 = Point(point1.x+(length*cosa1), point1.y+ +(length*cosb1))
endline2 = Point(point2.x+(length*cosa2), point2.y+ +(length*cosb2))
line1 = LineString([point1,endline1])
line2 = LineString([point2,endline2])

Plot

enter image description here

With these points and azimuths it's impossible for the lines to intersect

With another azimuth (137 + 180), the result is

enter image description here

and the intersection point is

print(LineString([point2,endline2]).intersection(LineString([point1,endline1])).wkt)
POINT (-2604425.761683417 4221776.053012035)
| improve this answer | |
  • I'm getting LINESTRING EMPTY in both cases, with or without adding 180 to 137, and there's a typo in your script, I think, "longueur". Is it "length"? – Mauro Assis Jun 30 at 21:10
  • There is a typo in the Southing coordinate of the second point. Also they are interpreted as Northing coordinates instead. The system is strange, I don't know if this difference will make the directions cross at a point. – Gabriel De Luca Jun 30 at 21:36
  • @gene: Sorry, my mistake. I changed the azimuths in the question. I already fixed it. It works! Tks a lot! – Mauro Assis Jul 1 at 3:22

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.