Questions tagged [geosphere]

An R package to calculate the distances and related measures for angular (longitude/latitude) locations

170 questions
0
votes
1 answer

MySQL filter data based on distance and calculate that distance

I have a use-case where the user pass his location (latitude and longitude) to the back-end, I have to get that location and find all the restaurant with in Miles radius area for his location at the same time I have to give the distance to each…
margherita pizza
  • 6,623
  • 23
  • 84
  • 152
0
votes
1 answer

Distance between points in GPX file becomes too large

I want to analyze distance traveled based on GPS tracks But when i calculate the distance it always comes out as too large. I use python to make a csv file with the latitude and longitude for all points in a track which i then analyze with R. The…
Ramon S.
  • 3
  • 2
0
votes
0 answers

Calculating distance using latitude and longitude error

I am using this code: a<-c(35.929673,-78.948237) b<-c(38.889510,-77.032000) c<-c(38.032120,-78.477510) d<-c(36.379450,-75.830290) df<-data.frame(a,b,c,d) for (i in 1:(ncol(df))) { for (j in (i+1):ncol(df)) { …
0
votes
1 answer

Calculation of the Center of Montana Using R Centroid Function Issues

I'm trying to find the center of Montana using the R centroid function in the geosphere package. The lat/long coordinates are stored in a shape file stored in xx that when calculated yield a result near Bermuda. Any suggestions as to how to fix…
Rafael
  • 3,096
  • 1
  • 23
  • 61
0
votes
3 answers

Flatten nested list of lists with variable numbers of elements to a data frame

I've got a nested list of lists that I'd like to flatten into a dataframe with id variables so I know which list elements (and sub-list elements) each came from. > str(gc_all) List of 3 $ 1: num [1:102, 1:2] -74 -73.5 -73 -72.5 -71.9 ... ..- attr(*,…
jogall
  • 651
  • 6
  • 21
0
votes
3 answers

Creating List of Observations from Matrix Values in R

I have a large matrix that is calculating the distance between two different zip codes (using rgeosphere package). I would like to run a function that finds all zip code pairings that are <=x distance away from each other and create a list of them.…
brandonps
  • 15
  • 5
0
votes
1 answer

Number of points within a radius with large datasets- R

I have county parcel level shapefiles and I'm aiming to calculate the number of parcels within a mile (about 1610 meters) in total, as well as with the same owner. I've worked through a solution, and below is my sample code, but it is fairly…
winitheju
  • 65
  • 1
  • 7
0
votes
2 answers

Calculating distance over a list

I have two list of coordinates, mapped_coords, unmapped_coords that are both a list of coordinates. I want to take the unmapped_coords and for every element return the index of the point with the min distance in mapped_coord. >…
Joseph Noirre
  • 387
  • 4
  • 20
0
votes
2 answers

Apply a function for every row in a dataframe for every row in another dataframe

I have two dataframes, "a" and "b". They both have gps data, but "a" has 1000 rows and "b" has 5 rows. I am comparing distances with the haversine formula, but I want to apply the function so that each row of "a" is compared to every row of "b". …
Sam
  • 59
  • 1
  • 8
0
votes
0 answers

r Calculate distance between longitude and latitude points

I have a data frame (locations_54) of columns with latitude and longitude values. I know there is the geosphere package in R, so, I wanted to use distHaversine() to get distance between two points with latitude and longitude. Here is what I have.…
user7426583
0
votes
0 answers

Seems like R can't see properly the variables in my function (pb pointsToMatrix)

I have created a function which run well on my local environment, but fail on the server. function(dataset1,nom_col_lon1,nom_col_lat1,dataset2,nom_col_lon2,nom_col_lat2,nom_col_ID2){ require(geosphere) mat.dist<-…
Oolis
  • 146
  • 2
  • 2
  • 13
0
votes
1 answer

Efficiently Calculate Distance using geosphere package

I have data with below format (number of rows: ~ 1 million) head(dt) pickup_longitude pickup_latitude dropoff_longitude dropoff_latitude 1: -74.00394 40.74289 -73.99337 40.73425 2: -73.97386 40.75219 …
Kartheek Palepu
  • 972
  • 8
  • 29
0
votes
0 answers

Incorrect number of dimensions when using geosphere package in R

Trying to calculate the distance matrix between lat/long points in two datasets.... This is my R script code and then the error message. Any ideas on where I am going wrong? > library(geosphere) ## step 1: open 2000 data for birds and air temp >…
0
votes
1 answer

R - Calculating geographical location after a time period

I have two points A and B with their respective latitude and longitude. I also have a time it takes to get from point A to point B. Let say it takes 1 hour and from A assume the driver goes straight to point B and mantains a same velocity during the…
TDo
  • 686
  • 4
  • 9
  • 22
0
votes
0 answers

Draw great circles in one direction

I am using the R Geosphere package to draw great circles connecting pairs of GIS coordinates between the US an India. As far as I can tell, the package calculates the closest distance between the two points on the geosphere and then plots the great…
1 2 3
11
12