great-circle

Shortest great circle distance between a point and a polygon on a sphere/globe

我是研究僧i 提交于 2019-12-12 08:56:45
问题 I have a set of polygons specified by geographic (WGS84) coordinates: they live on a sphere. I have a point specified by a latitude-longitude pair. I would like to (efficiently) find the minimum great circle distance between the point and the polygon. My current stack includes fiona, shapely, gdal, and proj. Similar questions on StackOverflow mostly seem to project features onto a plane and find distances there, or (disturbingly) omit mention of projections or lack thereof entirely. 回答1: This

Rotate a sphere from coord1 to coord2, where will coord3 be?

余生颓废 提交于 2019-12-11 05:52:19
问题 I have three coordinates (lat,lon) on a sphere. If you would rotate the whole sphere from coord1 to coord2, where will coord3 now be located? I've been trying this out in Python using Great Circle (http://www.koders.com/python/fid0A930D7924AE856342437CA1F5A9A3EC0CAEACE2.aspx?s=coastline) but I create strange results as the newly calculated points all group together at the equator. That must have something to do with the azimuth calculation I assume? Does anyone maybe know how to calculate

How to compare great circle distance with euclidean distance of two sphere points using python?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 17:49:16
问题 I am trying to check the error that is introduced when you compute the distance of two points on earth with the euclidean distance instead of using the great circle distance (gcd). I have two points that are defined by their lattitude and longtitude. I used the python geopy framework for the great circle distance. Here the code for the gcd: def measure(self, a, b): a, b = Point(a), Point(b) lat1, lng1 = radians(degrees=a.latitude), radians(degrees=a.longitude) lat2, lng2 = radians(degrees=b

R: Distm for big data? Calculating minimum distances between two matrices

偶尔善良 提交于 2019-12-10 10:11:16
问题 I have two matrices, one is 200K rows long, the other is 20K. For each row (which is a point) in the first matrix, I am trying to find which row (also a point) in the second matrix is closest to the point in the first matrix. This is the first method that I tried on a sample dataset: #Test dataset pixels.latlon=cbind(runif(200000,min=-180, max=-120), runif(200000, min=50, max=85)) grwl.latlon=cbind(runif(20000,min=-180, max=-120), runif(20000, min=50, max=85)) #calculate the distance matrix

Python calculate point of intersection of two great circles

筅森魡賤 提交于 2019-12-08 13:22:25
问题 I am trying to calculate the point of intersection (lat and lon in degrees) of two great circles that are each defined by two points on the circle. I have been trying to follow method outlined here. But the answer I get is incorrect, my code is below does anyone see where I went wrong? ################################################ #### Intersection of two great circles. # Points on great circle 1. glat1 = 54.8639587 glon1 = -8.177818 glat2 = 52.65297082 glon2 = -10.78064876 # Points on

Distance from Point To Line great circle function not working right.

爷,独闯天下 提交于 2019-12-06 06:20:08
问题 I need to get the distance from a lat/lng point to a line. Of course needs to follow the Great Circle. I found a great article on this at http://www.movable-type.co.uk/scripts/latlong.html but the code is not working right. Either I am doing something wrong or there is something missing. Here is the function in question. See the link for the other functions if needed. var R = 3961.3 LatLon.crossTrack = function(lat1, lon1, lat2, lon2, lat3, lon3) { var d13 = LatLon.distHaversine(lat1, lon1,

R: Distm for big data? Calculating minimum distances between two matrices

别说谁变了你拦得住时间么 提交于 2019-12-05 20:18:21
I have two matrices, one is 200K rows long, the other is 20K. For each row (which is a point) in the first matrix, I am trying to find which row (also a point) in the second matrix is closest to the point in the first matrix. This is the first method that I tried on a sample dataset: #Test dataset pixels.latlon=cbind(runif(200000,min=-180, max=-120), runif(200000, min=50, max=85)) grwl.latlon=cbind(runif(20000,min=-180, max=-120), runif(20000, min=50, max=85)) #calculate the distance matrix library(geosphere) dist.matrix=distm(pixels.latlon, grwl.latlon, fun=distHaversine) #Pick out the

Distance from Point To Line great circle function not working right.

久未见 提交于 2019-12-04 09:52:37
I need to get the distance from a lat/lng point to a line. Of course needs to follow the Great Circle. I found a great article on this at http://www.movable-type.co.uk/scripts/latlong.html but the code is not working right. Either I am doing something wrong or there is something missing. Here is the function in question. See the link for the other functions if needed. var R = 3961.3 LatLon.crossTrack = function(lat1, lon1, lat2, lon2, lat3, lon3) { var d13 = LatLon.distHaversine(lat1, lon1, lat3, lon3); var brng12 = LatLon.bearing(lat1, lon1, lat2, lon2); var brng13 = LatLon.bearing(lat1, lon1

Automating great-circle map production in R

若如初见. 提交于 2019-12-04 04:40:37
I've taken some of the things I learned in a Flowing Data great circle mapping tutorial and combined them with code linked in the comments to prevent weird things from happening when R plots trans-equatorial great circles. That gives me this: airports <- read.csv("/home/geoff/Desktop/DissertationData/airports.csv", header=TRUE) flights <- read.csv("/home/geoff/Desktop/DissertationData/ATL.csv", header=TRUE, as.is=TRUE) library(maps) library(geosphere) checkDateLine <- function(l){ n<-0 k<-length(l) k<-k-1 for (j in 1:k){ n[j] <- l[j+1] - l[j] } n <- abs(n) m<-max(n, rm.na=TRUE) ifelse(m > 30,

Calculating great-circle distance matrix

送分小仙女□ 提交于 2019-12-02 12:52:56
问题 dist(coords) provides the distance matrix using Euclidean distances; it also provides several other options. But it doesn't provide any option such as the haversine formula. distHaversine() calculates the distance I want (great-circle) for given two set of lat/long coordinates. I am wondering if there is an existing package/function that calculates great-circle distance matrix using the haversine formulation. 回答1: As you may already have noticed, distHaversine() will compute the distance