Questions tagged [distance]
The measure of separation between two entities or locations that may or may not be connected, such as two points.
1,570
questions
85
votes
2
answers
488k
views
Calculating longitude length in miles
Suppose I have the geographic coordinates of "Saratoga, California, USA" as
Latitude: 37°15.8298′ N
Longitude: 122° 1.3806′ W
I know from here that in the case of latitude 1° ≈ 69 ...
77
votes
2
answers
21k
views
How accurate is approximating Earth as sphere?
What level of error do I encounter when approximating the earth as a sphere? Specifically, when dealing with the location of points and, for example, the great circle distances between them.
Are ...
67
votes
9
answers
75k
views
Finding nearest point in other GeoDataFrame using GeoPandas
I've got two geodataframes:
import geopandas as gpd
from shapely.geometry import Point
gpd1 = gpd.GeoDataFrame([['John',1,Point(1,1)],['Smith',1,Point(2,2)],['Soap',1,Point(0,2)]],columns=['Name','ID'...
59
votes
6
answers
40k
views
Why is the 'straight line' path across continent so curved?
This is the result of mapping the straight line path from a point in US to Poland using Distance Measurement Tool.
Also, planes from Asia to US would travel almost over North Pole.
Why is the path ...
59
votes
7
answers
158k
views
Calculating Latitude/Longitude X miles from point?
I am wanting to find a latitude and longitude point given a bearing, a distance, and a starting latitude and longitude.
This appears to be the opposite of this question (Distance between lat/long ...
46
votes
3
answers
45k
views
Why is law of cosines more preferable than haversine when calculating distance between two latitude-longitude points?
In fact, when Sinnott published the
haversine formula, computational
precision was limited. Nowadays,
JavaScript (and most modern computers
& languages) use IEEE 754 64-bit
floating-...
45
votes
6
answers
61k
views
Trilateration using 3 latitude/longitude points, and 3 distances?
I want to find out an unknown target location (latitude and longitude co-ordinates). There are 3 known points (latitude and longitude co-ordinate pairs) and for each point a distance in kilometers to ...
43
votes
9
answers
96k
views
Generating random locations nearby?
I am trying to create random locations nearby my location. What i want is to create random latitude/longitude pairs inside a 200 meters circle surrounding my location.
This is the formula i came up ...
41
votes
6
answers
116k
views
Drawing lines from points in QGIS
I have a point layer and need to draw a line passing through or in the vicinity of the points (up to 0.5m distance between the point and the line).
The nodes of the line will receive the attributes of ...
39
votes
4
answers
95k
views
Return all results within a 30km radius of a specific lat/long point?
I have a table with a column the_geom which contains data similar to:
...
39
votes
7
answers
54k
views
Clustering spatial data in R? [closed]
I have bunch of data points with latitude and longitude. I want to use R to cluster them based on their distance.
I have already taken a look at this page and tried clustTool package. But I am not ...
38
votes
3
answers
18k
views
What is approximate error of Pythagorean Theorem vs. Haversine Formula in measuring distances on sphere at various scales?
Many people when first trying to calculate distances between two longitude / latitude pairs ask if Pythagorean theorem works as an appropriate distance function.
Most often people answer "no, the ...
35
votes
5
answers
46k
views
PostGIS nearest points with ST_Distance, kNN
I need to obtain on each element on one table the closest point of another table. The first table contains traffic signs and the second one the Entrance Halls of the town.
The thing is that I can't ...
27
votes
6
answers
22k
views
What tools in Python are available for doing great circle distance + line creation?
I need to use Python to create a great circle distance -- both a number, and preferably some kind of 'curve' that I can use to draw in a client-side map. I don't care about the format of the curve -- ...
26
votes
7
answers
62k
views
Creating points in specified distance along line using QGIS
I want to use QGIS creating points along the line, but in specified distance. I found two GRASS tools in SEXTANTE Toolbox:
v.to.points
v.segment
I tried v.to.points, setting the maximum distance ...
25
votes
5
answers
151k
views
Find features within given coordinates and distance using MySQL
I have a MySQL table with user name, latitude and longitude of the user.
I would like to get a list of users who are inside the circle or square of a given latitude and longitude with given distance. ...
25
votes
5
answers
44k
views
Finding distance of point along polyline using ArcGIS Desktop?
We need to find the distance of a series of point along a given polyline.
We have a polyline dataset repsenting rivers in a catchment, broken up into river reaches (FID 1 through 35 for example).
We ...
23
votes
12
answers
19k
views
Which tools and methods can be used to create isochrones?
I'd like to get an idea for what's involved in creating isochrones for a series of sites, with a reasonable degree of accuracy to the estimates. A general outline would be great, though my scenario ...
22
votes
3
answers
38k
views
Adding Direction and Distance into attribute table in QGIS
I just want to add direction (Bearing: i.e N 25 35 E) and Distance (Length: 125 meters) as my new field in polyline/line data.
Is there a Plugin to generate these fields?
I tried to used Export/Add ...
22
votes
2
answers
682
views
Precision when working with spatial data in GIS
Is there a basic or introductory study that examines and compares the precision of spatial data when working
with varying precison of the data input, like having 1, 2, ... decimal places?
with the ...
21
votes
3
answers
7k
views
Finding distance between two coordinates in ellipsoid?
I have two sets of latitude and longitude.
How do I find the distance between the two locations if I assume the earth is a perfect ellipsoid (with an eccentricity of 0.0167)?
20
votes
3
answers
24k
views
Algorithm to find nearest point
I have a list of a few hundred cities with their latitude/longitude. Given another location (also in lat/long) I need to find the nearest city.
As I don't use any GIS, by now the obvious algorithm is ...
20
votes
2
answers
15k
views
Calculating distance to points in QGIS
Is there a way of calculating the distance to the nearest points in QGIS?
In ArcGIS Desktop there is a function called Euclidean Distance, which can take an input vector or raster, and generate a ...
18
votes
1
answer
11k
views
What is difference between ST_DWithin and ST_Distance for proximity search in PostGIS?
I have records stored in a table with latitude/longitude coordinates stored in a geometry field. I want to find all records nearby a user supplied reference point. Note "nearby" probably means less ...
17
votes
5
answers
35k
views
Difference between Vincenty and great-circle distance calculations?
Python's geopy package features two distance measurements techniques: Great Circle and Vincenty's formulae.
>>> from geopy.distance import great_circle
>>> from geopy.distance ...
17
votes
6
answers
41k
views
Finding distance between two points with GeoSeries.distance
When I want the distance between two points [(117.454361,38.8459879),(117.459880 ,38.846255)] (longitude,latitude) on the earth, I take the GeoSeries.distance method, but the method does not give me ...
17
votes
2
answers
26k
views
Getting distance meter value between two geometries in PostGIS
I am using PostGIS.
I would like to get the distance between two geometries. I am using this sid : 4269 in meters
what i am doing now is this : ST_Distance((a.geom,b.geom)) FROM ... but I am getting ...
17
votes
1
answer
2k
views
Monte Carlo simulation using QGIS and pgRouting on optimal sidewalk construction
I am new to spatial analysis and would appreciate some general direction on a project I am attempting, outlined below (I am starting from scratch).
GOAL: To find the best locations to install 2000 ...
16
votes
4
answers
39k
views
How do I calculate the bounding box for given a distance and latitude/longitude
I need to be able to calculate a bounding box or circle for a given WGS84 latitude and WGS84 longitude, and distance but have no idea where to start!
The distance from the start Lat/Lon would be 10Km ...
16
votes
2
answers
2k
views
Constructing a Voronoi diagram using a complicated travel time metric
I have in my possession four sets of shapefiles:
1. Locations (points), around 1000
2. Roads (lines), each road has a speed attribute
3. Terrain (polygons), each zone also has a speed attribute
4. ...
15
votes
4
answers
51k
views
Calculating minimum distance between points and polygons in QGIS?
I have two vector layers: one point and one polygon and I want to calculate the minimum distance of each point from the polygons (ie the distance from the closest point of the closest polygon).
Is ...
15
votes
2
answers
19k
views
Calculating shortest distance from point to line using QGIS?
What is the best method to calculate the distance from the nearest road for a series of address points in QGIS, having a very big dataset? (QGIS 2.0.1, Win XP)
I read the answers to previous similar ...
15
votes
1
answer
20k
views
Calculating distance scale factor by latitude for Mercator
This was really inconvenient topic to google out - so I'm asking for clarification, did I understood things correctly.
I'm talking about measuring short distances in Mercator projection (3857). You ...
14
votes
1
answer
18k
views
Calculate distance from a Point within a Polygon to its edge
Let's say we have the following point and polygon:
poly = Polygon([(0, 0), (2,8), (14, 10), (6,1)])
point = Point(4,4)
Because point lies within poly, the distance from the first to the latter will ...
14
votes
3
answers
2k
views
How can I represent distance using the dashes or markers of a vector line?
I am a very basic user and dont know the lingo to get to the gist of my question so some background might help.
Ive volunteered to create a pre-incident planning system for my rural fire department. ...
14
votes
2
answers
5k
views
Projections appropriate for global analysis that preserve area and that preserve distance (but not necessarily in the same projection)
I am looking for a projection (or a set of projections) that decently preserve distances so that I can buffer every country in the world and have a similar level of minimal distortion for each.
I ...
14
votes
1
answer
1k
views
Creating Buffer Polygon following Elevations using ArcGIS Desktop?
What I'm looking to do is put a 100 m buffer on a polygon, but rather than the buffer being at a fixed width "as the crow flies" I want it to follow the slopes of my Lidar DEM.
I have ArcMap (with 3D ...
13
votes
4
answers
4k
views
Calculating line with the longest distance inside polygon in QGIS
I want to calculate the "diameter" of polygons in QGIS. The "diameter" is defined as the distance between the two most distant points of the polygon.
I couldn't find a fitting ...
13
votes
6
answers
24k
views
Getting distance between 2 points using GeoDjango? [closed]
I have 2 locations defined by gps coords, lat / long like returned by google maps:
http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html
I need to calculate the distance between ...
13
votes
3
answers
5k
views
Connecting line features and determining the length of the longest line
I have a line feature (see image) representing a river that I created using the Stream_to_Feature tool. The attribute table contains several records representing different lines - the problem is the ...
13
votes
2
answers
27k
views
Calculate distance between points and nearest polygon in R
I have a data frame with among others longitude and latitude as variables for about 17,000 points. I also have a shapefile consisting of multiple polygons. The points fall inside or outside the ...
13
votes
5
answers
15k
views
Calculating distance of point along line using QGIS
I have a polyline (movement path) and points recorded along the line. I would like to calculate for each point the distance along the line in QGIS. I hope for a result which will add a new column to ...
12
votes
3
answers
4k
views
What is the right solution (and map projection) to compute distances between points located all over the World?
After my study on map projection I realized that it is very difficult to choose a projection that allows to compute simultaneously the distances between a great deal of points if these points are ...
12
votes
2
answers
2k
views
Surface distance on DEM between two coordinates
Given two coordinates on a digital elevation model (DEM), how do I compute the actual distance traveled between the two locations, assuming a straight line route? How will changing the resolution of ...
12
votes
3
answers
511
views
Distinguishing corridors from fragments in a habitat map
I was wondering if someone has delt with this kind of issue before:
I want to delineate fragments based on neighboring pixels of the same class (forest) with a distance threshold of 3 pixels (which ...
12
votes
1
answer
2k
views
How big does a circular geofence need to be for the curvature of the earth to matter? [duplicate]
I'm working on adding geofences to a mobile application. I know the proper way of calculating distance between two points on a sphere is using the great-circle or Haversine formula. I don't know if ...
11
votes
1
answer
23k
views
Simple PostGIS ST_Distance query for two points from the same geometry table?
Note: This question was published at Stackoverflow at first.
I have a geometry table points_table with SRID 4326 and a few points in it.
I need to find a distance between a pair of points (features) ...
11
votes
5
answers
12k
views
Better Distance Measurements in Web Mercator Projection
I am working with an ESRI stack, storing my layers in a sql-spatial-enabled-SDE- geodatabase (Geometry type, Web Mercator-3857).
I am building a web mapping application, so by default, the tiles are ...
11
votes
3
answers
11k
views
Distance between lat/long points
I am attempting to calculate the distance between two latitude/longitude points. I have a piece of code that mostly works that I yanked from this post but I do not really understand how it works.
...
11
votes
3
answers
3k
views
Finding most remote spot in Eastern United States?
I have this hunch that I could travel no more than 50 miles from the most remote spot in the Eastern United States (east of the Mississippi River), in the direction of the nearest road, and find a ...