Geographic Information Systems Asked by Rollo Tomassi on December 28, 2020
I have a spreadsheet that contains ID, LAT_DD, LONG_DD, Bearing and LEN fields. I need to automate a way to create a triangle for every point identified in the table and I have no idea how. I know the steps should be as follows:
I’m fairly new to GIS programming and don’t even know where to start. I can create the points, but that’s it.
ArcGIS may have its own operation to calculate a point on a specific bearing and distance, but a great source for these types of calculations is the Aviation Formulary at: https://edwilliams.org/avform.htm
In particular you want the "Lat/Long given radial and distance" :
Lat/lon given radial and distance
A point {lat,lon} is a distance d out on the tc radial from point 1 if:
lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)) IF (cos(lat)=0) lon=lon1 // endpoint a pole ELSE lon=mod(lon1-asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi ENDIF
This algorithm is limited to distances such that dlon around less than one quarter of the circumference of the earth in longitude. A >completely general, but more complicated algorithm is necessary if greater distances >are allowed:
lat =asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)) dlon=atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(lat)) lon=mod( lon1-dlon +pi,2*pi )-pi
Note that trigonometry functions are in radians - you'll have to convert to/from degrees (Radians = Degrees*PI/180 )
Answered by winwaed on December 28, 2020
ArcGIS has a number of geodetic operators available in the Projection Engine exposed through ArcPy as methods on the PointGeometry type.
The so-called "Forward Problem of Geodesy" is solved by the PointGeometry.pointFromAngleAndDistance()
request, with required parameters angle
(in degrees) and distance
(in meters), and optional parameter method
(one of GEODESIC
, GREAT_ELLIPTIC
, LOXODROME
, and PRESERVE_SHAPE
-- PLANAR
is not available for geographic coordinate systems).
The "Inverse" (aka "Reverse") problem is solved by PointGeometry.angleAndDistanceTo()
with required parameter other
(the target PointGeometry
), and optional parameter method
(same as above), and returns a tuple of angle (in degrees) and distance (in meters) from the reference point.
Note that ArcPy also has a Point
object, but this is a different object, which just stores multidimensional vertices. A Point
is used with a SpatialReference
to construct a PointGeometry
.
The full solution for computing distance from New York (JFK) to Tokyo (Narita) in WGS84, and calculating the halfway point between them would look like:
import arcpy
gcs = arcpy.SpatialReference(4326)
gcs.setFalseOriginAndUnits(-400.0,-400.0,10000000)
jfk = arcpy.PointGeometry(arcpy.Point(-73.7781,40.6413),gcs)
nrt = arcpy.PointGeometry(arcpy.Point(140.3929,35.7720),gcs)
bearing,distance = jfk.angleAndDistanceTo(nrt,'GEODESIC')
print(" Bearing = {:.2f} deg".format(bearing))
print("Distance = {:.2f} meters".format(distance))
midpoint = jfk.pointFromAngleAndDistance(bearing,distance*0.5,'GEODESIC')
print("Midpoint = {:4f},{:.4f}".format(
midpoint.firstPoint.X,
midpoint.firstPoint.Y))
Which results in:
Bearing = -27.32 deg
Distance = 10853320.27 meters
Midpoint = -152.890242,69.4824
and feels right (10853 kilometer NNW polar route over Alaska).
Answered by Vince on December 28, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP