avni.mapping.spherical module#
- avni.mapping.spherical.intersection(path1start: Union[list, numpy.ndarray], path1brngEnd: Union[float, int, list, numpy.ndarray], path2start: Union[list, numpy.ndarray], path2brngEnd: Union[float, int, list, numpy.ndarray])[source]#
Get the intersection of two great circle paths. Input can either be point and bearings or two sets of points.
If c1 & c2 are great circles through start and end points (or defined by start point + bearing), then candidate intersections are simply c1 X c2 & c2 x c1 most of the work is deciding correct intersection point to select! If bearing is given, that determines which intersection, if both paths are defined by start/end points, take closer intersection https://www.movable-type.co.uk/scripts/latlong-vectors.html#intersection
- Parameters
- path1starttp.Union[list,np.ndarray]
Location of start point of the first curve in [latitude, longitude]
- path1brngEndtp.Union[float,int,list,np.ndarray]
End point of first curve either in terms of a bearing (float/int) or location [latitude, longitude]
- path2starttp.Union[float,int,list,np.ndarray]
Location of start point of the second curve in [latitude, longitude]
- path2brngEndtp.Union[float,int,list,np.ndarray]
End point of second curve either in terms of a bearing (float/int) or location [latitude, longitude]
- Returns
- intersection
Preferred intersection of the two curves based on the input
- antipode
Antipode of the intersection where the great-circle curves meet as well
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.mapping.spherical.midpoint(lat1: Union[int, float], lon1: Union[int, float], lat2: Union[int, float], lon2: Union[int, float])[source]#
Get the mid-point from positions in geographic coordinates. Input values as degrees
- avni.mapping.spherical.cart2spher(xyz: Union[list, numpy.ndarray]) numpy.ndarray [source]#
Convert from cartesian to spherical coordinates.
- Parameters
- xyztp.Union[list,np.ndarray]
Data containing columns for x,y,z locations in cartesian coordinates
- Returns
- np.ndarray
Output containing radius, latitude and longitude in spherical coordinates
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.mapping.spherical.spher2cart(rlatlon: Union[list, numpy.ndarray]) numpy.ndarray [source]#
Convert from spherical to cartesian coordinates.
- Parameters
- rlatlontp.Union[list,np.ndarray]
Data containing columns for x,y,z locations in spherical coordinates
- Returns
- np.ndarray
Output containing x,y,z in spherical coordinates
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.mapping.spherical.polar2cart(rtheta: Union[list, numpy.ndarray]) numpy.ndarray [source]#
Convert from polar to cartesian coordinates
- Parameters
- rthetatp.Union[list,np.ndarray]
A single r,theta or an array of these for conversion
- Returns
- np.ndarray
Output containing x,y in cartesian coordinates
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.mapping.spherical.cart2polar(xy: Union[list, numpy.ndarray]) numpy.ndarray [source]#
Convert from polar to cartesian coordinates
- Parameters
- xytp.Union[list,np.ndarray]
A single x,y or an array of these ffor conversion
- Returns
- np.ndarray
Output containing r,theta in polar coordinates
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.mapping.spherical.getDestination(lat: Union[int, float], lon: Union[int, float], azimuth: Union[int, float], distance) list [source]#
Returns the location of destination point given the start lat, long, aziuth, and distance (in meters).
- Parameters
- lat, lontp.Union[int,float]
Start point latitude and longitude
- azimuthtp.Union[int,float]
Azimuth to destination
- distance
Distance to destination (in meters)
- Returns
- list
List containing latitude and longitude of destination point
- avni.mapping.spherical.calculateBearing(lat1: Union[int, float], lon1: Union[int, float], lat2: Union[int, float], lon2: Union[int, float])[source]#
Calculates the azimuth in degrees from start point to end point.
- Parameters
- lat1,lon1tp.Union[int,float]
Start point latitude and longitude
- lat2,lon2tp.Union[int,float]
End point latitude and longitude
- Returns
- bearing
Bearing to second point
- Authors
Raj Moulik (moulik@caa.columbia.edu)
- Last Modified
2023.02.16 5.00
- avni.mapping.spherical.getIntermediate(lat1: Union[int, float], lon1: Union[int, float], azimuth: Union[int, float], distance: Union[int, float], interval: Union[int, float]) list [source]#
Returns intermediate coordinates between two coordinate pairs given a desired interval
- Parameters
- lat1,lon1tp.Union[int,float]
Start point latitude and longitude
- azimuthtp.Union[int,float]
Azimuth to destination
- distance
Distance to destination (in meters)
- intervaltp.Union[int,float]
Interval for intermediate points (in meters)
- Returns
- list
Coordinates (lat,lon) of intermdiate points
- avni.mapping.spherical.calculateDistance(lat1: Union[int, float], lon1: Union[int, float], lat2: Union[int, float], lon2: Union[int, float], final_units='m') float [source]#
Calculates distance between two coordinates
- Parameters
- lat1,lon1tp.Union[int,float]
Start point latitude and longitude
- lat2,lon2tp.Union[int,float]
End point latitude and longitude
- final_unitsstr, optional
Output distance in km/m/deg, by default ‘m’
- Returns
- float
Distance between coordinate pairs in m, km or deg