Questions tagged [geosphere]

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

170 questions
0
votes
1 answer

Generating GPS Coordinates / creating a raster of evenly distributed points 1km apart

i would like to cover an area defined by a bbox lat long coordinates with a raster of gps points 1 km apart. Currently i generate 2000 points for a bboxbbox=8.9771580802,47.2703623267,13.8350427083,50.5644529365 the following…
Andreas
  • 397
  • 4
  • 18
  • 37
0
votes
1 answer

Find Coordinates in One Dataset That Match A Buffer of Coordinates in Another Dataset in R

I have two datasets, one smaller dataset (4000 rows) that contains information about different stores with each shops lat/long coords and one large dataset(600K Rows) that contains information about people who live in the area with their lat/long…
aport550
  • 119
  • 1
  • 9
0
votes
1 answer

How to Form a Circle as a Radius around geocoordinates on a GGPlot Map

I have 2 geospatial datasets - one that identifies hospital and that identifies procedures that took place either in, near or away from such hospitals. Im using ggplot to create a map with points showing all the hospitals and all the procedures…
aport550
  • 119
  • 1
  • 9
0
votes
1 answer

Calculating the distance between two long/lat points in the same data.frame

For starters, here is the table structure I'm using: df <- structure(list(customer_id = c(353808874L, 69516747L, 357032052L, 307735090L, 307767260L), id = c("8474", "8107", "1617436", "7698", "1617491"), lon1 = c(-115.032623, -115.155029,…
user9302275
0
votes
1 answer

Use the geosphere::distm in a more efficient way?

Using location data of stores, I'm trying to find 'competitors' -- which is defined as other stores within a certain distance. I'm using geo sphere::distm and some matrix operations like below. The problem is that my matrix is pretty big (100,000 X…
wyatt
  • 371
  • 3
  • 13
0
votes
0 answers

R: distHaversine function not delivering expected results

I am using distHaversine function to find the distance between the Vatican and a list of German cities. mutate(kita_fees_df, distance = distHaversine(cbind(Longitude, Latitude), cbind(40.5409, 12.2709))) regional_schlÃ.ssel city_kreis Latitude …
Collective Action
  • 7,607
  • 15
  • 45
  • 60
0
votes
0 answers

Distance Matrix in R using geosphere

I have a dataset with info on international investments in Europe and coordinates about NUTS3. For each investment I have the city and the coordinates (lat1,long1). I want to compute the distance from each city to each of the NUTS 3 I have --> E.G.…
Dalila
  • 181
  • 2
  • 2
  • 8
0
votes
1 answer

geosphere::areaPolygon returns different results based on ordering of vertices

I am trying to calculate the area of a polygon defined in terms of latitude and longitude: example_polygon <- data.frame( lat = c(42.7093213,42.7079761,42.7093941,42.7080938,42.7093213), lon =…
demirev
  • 175
  • 1
  • 8
0
votes
0 answers

Get a latitude/longitude pair from starting point and distance travelled south and east

I'm trying to calculate a lat lng point from a starting point and a distance travelled south and east. what geosphere function would I use to calculate that? new_coordinate <- nc(latitude, longitude, km_south, km_east) new_coordinate [1] 49.49578…
Lawrence
  • 1
  • 1
0
votes
1 answer

determine closest site and select another variable from that location

I have study sites where I've collected data and nearby weather stations with information on temperature and precipitation. I'd like to pair my daily data at the study sites with weather information from the closest weather station. I think, to do…
tnt
  • 1,149
  • 14
  • 24
0
votes
0 answers

Merge coordinate into existing line

I want to merge additional spatial coordinates into a preexisting spatial line. My data: Spatial coordinates representing coastlines. Spatial coordinates representing observations. Observations do not necessarily match coordinates on the lines, so…
jat
  • 93
  • 1
  • 8
0
votes
2 answers

Deal with coordinates and huge datasets in R

I am struggling a bit with two datasets containing coordinates of individuals and cell towers: A first dataset on 9,459 individuals with 1,214 variables including their latitude and longitude in degrees. a second dataset on 31,176 cell towers with…
0
votes
3 answers

calculate mean daylength across a varying range of dates

I'm using the daylength function in the geosphere package to calculate day length at a location between two points. Depending on the specific individual and location, in the number of days over which I'm averaging day length varies. While my…
tnt
  • 1,149
  • 14
  • 24
0
votes
1 answer

How to fix function that calculate distance between 2 coordinates

I currently have a column of coordinates(CHR) and longitude & latitude(NUM). I want to create a function that allows to find the distance between each two coordinates. like distance between 1st and 2nd coord, 2nd and 3rd, an so on. I have tried both…
Xichen Yao
  • 15
  • 2
0
votes
2 answers

Error calculating the distance between values from a data.frame

I'm trying to calculate the distance between different points that are a subset from a data.frame. The method I try to use is distHaversine from library geosphere. I have my data in var st and try using the function such…
Jesper.Lindberg
  • 313
  • 1
  • 5
  • 14