Questions tagged [geographic-distance]

Geographical distance is the distance measured along the surface of the earth.

Geographical distance is the distance measured along the surface of the earth.

77 questions
19
votes
7 answers

Python module for storing and querying geographical coordinates

Is there a Python module where I can create objects with a geographical location coordinate (latitude and longitude), and query all the objects for ones which are within a 5km distance (i.e. radius) of a given coordinate? I've been trying to store…
Jon Cox
  • 10,622
  • 22
  • 78
  • 123
9
votes
1 answer

Calculate all distances between two GeoDataFrame (of points) in GeoPandas

This is quite simple case, but I did not find any easy way to do it so far. The idea is to get a set of distances between all the points defined in a GeoDataFrame and the ones defined in another GeoDataFrame. import geopandas as gpd import pandas as…
Leonard
  • 2,510
  • 18
  • 37
7
votes
2 answers

Measuring geographic distance with scipy

I fail to use the outcome of scipy's pdist function. I am interested in the real geographic distance (preferred unit: km). Take the following coordinates: from scipy.spatial.distance import pdist coordinates = [ (42.057, -71.08), (39.132, -84.5155)…
MERose
  • 4,048
  • 7
  • 53
  • 79
7
votes
5 answers

How to get the nearest location entries from a database?

I store coordinates as latitude longitude pairs in my database. Now, I need to retrieve all the entries that are within a given radius from a given lat-long coordinate. For example, if given coordinates 48.796777, 2.371140 and distance of 20…
manabreak
  • 5,415
  • 7
  • 39
  • 96
6
votes
2 answers

Matching data frames based on shortest geographic distance

I have two dataframes, both of which contain latitude and longitude coordinates. The first dataframe is observations of events, where the location and time was recorded. The second dataframe is geographic features, where the location and info about…
Conor Neilson
  • 1,026
  • 1
  • 11
  • 27
4
votes
0 answers

How to visualize a distance matrix on a map?

Good morning. I have created a distance matrix in which there are distances between EU regions (NUTS2 level), considering some economic and demographic features. Then I have kept only distances from "Lombardia" (an Italian region) and i have ordered…
4
votes
2 answers

R distance matrix with non-zero values on diagonal (rdist.earth )

The entries on the diagonal of a spatial distance matrix should be zero, bc they represent the distance between each location and itself. But the rdist.earth() function from the fields R package sometimes give me non-zeros on the diagonal: > # Set…
4
votes
1 answer

SQL Geometry VS decimal(8,6) Lat, Long Performance

I was looking into performance of selecting closest points within certain proximity to given coordinate. Options are to ether use two decimal(8,6) - lat, long columns or single geography column and work with that. I am only interested which is…
4
votes
0 answers

Calculate square bounds on Earth with given radius for center point

I'm trying to calculate bounds for square with particular radius and when center of square is known(longitude, latitude). But I'm getting into troubles with it. I've tried to use haversine formula from here : But I'm getting into troubles when…
hades
  • 1,077
  • 3
  • 11
  • 19
4
votes
2 answers

Distance of wgs point from a wgs defined line segment

I searched but I could not find a complete answer. In C# if at all possible. I need the shortest distance between a WGS point and a WGS point defined line segment on a sphere (Earth exactly). float DistanceInKilometres(PointF LineStartA, PointF…
JJ_Jason
  • 349
  • 8
  • 24
3
votes
1 answer

Get pitch, roll and yaw relative to geographic north on iOS?

I see that I can retrieve CMAttitude from a device and from it I can read 3 values which I need (pitch, roll and yaw). As I understand, this CMAttitude object is managed by CoreMotion which is a Sensor Fusion manager for calculating correct results…
vale4674
  • 4,161
  • 13
  • 47
  • 72
3
votes
0 answers

Algorithm for shortest distance from point to extended shape, on the geoid

Is there a standard algorithm for finding the shortest distance from a point to an arbitrary extended shape (a MultiPolygon, in GIS terms — might be concave, might have holes, might be a cluster of islands) on the surface of the Earth? I'm aware of…
zwol
  • 135,547
  • 38
  • 252
  • 361
3
votes
3 answers

Calculating distance between two points using latitude longitude and altitude (elevation)

I'm trying to calculate distance between two points, using latitude longitude and altitude (elevation). I was using euklides formula in order to get my distance: D=√((Long1-Long2)²+(Lat1-Lat2)²+(Alt1-Alt2)²) My points are geographical coordinates…
sebb
  • 1,956
  • 1
  • 16
  • 28
3
votes
3 answers

.NET Equivalent of SQL Server STDistance

I can use the following SQL to calculate the distance between a fixed location and the location against the venues in the database. SELECT Location.STDistance(geography::Point(51, -2, 4326)) * 0.00062137119 FROM Venues Please note the distance…
nfplee
  • 7,643
  • 12
  • 63
  • 124
2
votes
1 answer

How do I calculate the centroid point of multiple longitude and latitude data points in BigQuery?

I have a dataset with various longitude and latitude datapoints. I would like to develop a centroid or "average" of those longitude and latitude coordinates in bigquery at a specific level of granularity. Example of Current…
Jaskeil
  • 1,044
  • 12
  • 33
1
2 3 4 5 6