11
votes
Accepted
Why is SQL Server 2019's STDistance Very Slightly Different Than The Vincenty Formula? (Same Up To ~0.0001km)
SQL Server's STDistance function does not compute geodesic distances. Its algorithm essentially generates straight lines in 3D, densifies them and maps them on the ellipsoid in a manner described more ...
11
votes
How do I interpret the results from the distance matrix?
You can use a heatmap renderer for your point layers (in the symbology, change from Single Symbol to Heatmap) to see how/if the patterns overlap. That's probably the easiest and fastest way to get a ...
8
votes
Calculating distance between points of same layer using QGIS?
There are a couple of versions of this tool. If you use the one from the Processing Toolbox, it will contain distances within the origin points. Instead, use the Distance Matrix tool from the menubar:
...
8
votes
Accepted
Distance between two points - by ID in QGIS
Assuming your data structure is like below
id, start_x, start_y, end_x, end_y
This is straighforward in QGIS if you have data in a projected CRS. You can add your text file as a vector layer, and ...
7
votes
What algorithm does QGIS use to calculate Nearest Neighbor Index?
You can check the source code for the Nearest Neighbour Analysis tool from GitHub. More specifically, the following lines of code which shows how the different parameters are calculated:
do = float(...
6
votes
Accepted
Solving ‘Null geometry…’ error during distance matrix operation?
The file signif.txt has missing lon/lats for some records which result in null geometries when you add as a delimited text layer or convert to other format.
Either delete them or filter (Right click ...
6
votes
Accepted
No output in PyQGIS standalone script running Distance Matrix?
I have found and fixed the final errors. I tried changing how each algorthim parameter got its value.
By changing the code below:
inputfield = QgsProperty.fromField("InputPointID")
targetfield = ...
6
votes
Accepted
Aggregating features values based on distance in QGIS
Let's assume there is a polygon layer called 'grid_test' with nine features in it, see image below.
Step 1. Apply the "Centroids" (This step you already did)
Step 2. By means of the "...
6
votes
Calculating distance between consecutive points in same point layer in QGIS
You can use the following script in QGIS Python Editor. It returns the distance in meter for geographic crs.
Note: ID field should be integer/numeric. If it is string, you get wrong order like: 1, 10, ...
5
votes
Accepted
distance matrix with a linear feature
I did have the same the same research question as you. I wanted to calculate the distance from archaeological sites to rivers. I did have access to a hydrological layer by INEGI. I did have rivers as ...
5
votes
Accepted
Distance Matrix PostGis
As others have said, I don't think this pivot can be done in PostgreSQL however the distance calculation certainly can be. First you need a simple table of the distances, because ST_Distance and all ...
5
votes
Accepted
Calculate distance matrix in km units
The unit of EPSG:27700, OSGB 1936 / British National Grid is meter, which means the distances you got are in meter. You need to divide by 1000 and you will get the distance in km.
5
votes
Excluding point from Nearest neighbor search once it's been matched using R?
Here's a sequential algorithm that used FNN::get.knnx to get the nearest neighbour of each point in list1 in succession, dropping the nearest neighbour from list2 and keeping track of its index in the ...
5
votes
Accepted
Calculate distances from points to multiple country borders in QGIS
You can achieve this using a virtual layer.
The idea is to read the points, join them to the polygon layer to get the polygons where the points are located, then join again these polygons to the ...
5
votes
Measuring minimum distances for closest features between two polygon layers in QGIS
On the orange polygon, use this expression to get an array of the $id of the green polygons within 10000 m distance:
overlay_nearest ('green',$id, max_distance:=10000,limit:=-1)
Replace green with ...
5
votes
Calculating distance between consecutive points in same point layer in QGIS
I'm sure there's some less complicated way, but you can use pyqgis like this:
lyr = QgsProject.instance().mapLayersByName('Vertices')[0] #Change Vertices to the name of your layer
orderfield = '...
4
votes
Accepted
QGIS: Distance units in CRS layer: WGS 84
Edit: I assume you are using EPSG:4326 as CRS since it is the most common WGS84 CRS. If it is not the case, you should precise which CRS you are using based on the EPSG code.
Distances in a WGS84 (...
4
votes
Accepted
QGIS: calculate distance between points
Have you tried the Points2One plugin mentioned in this post.
You should be able to create lines, grouped by the point IDs. Once you have the line layer you could calculate a line length to get the ...
4
votes
Accepted
OSM table(Matrix) Api returning distance 0 for small routes
You need to swap the coordinates, Lat in place of long and long in place of lat as below:
http://router.project-osrm.org/table/v1/drive/72.5024,22.9755;72.5647,23.0143;72.4796,23.0483?sources=0
4
votes
Accepted
QGIS Distance Matrix Output
Depending on what exactly you want to do with the data once you know the start, end and distance between the points you may find that the "Linear (N*k x 3) distance matrix" output matrix type is ...
4
votes
Calculating shortest distance between points within polygon using QGIS?
I have no idea on how to do it with shapefile with existing tools, but an algorithm that iteratively adds vertices of the polygon to the line that joins the two points (until the new line is fully ...
4
votes
Accepted
Distance Matrix with 2 point shapefiles and one street network
You can use the plugin QNEAT3 which is available for QGIS3. It offers multiple processing algorithms that produce origin-destination matrices (OD-Matrix) as line layer, table or csv file. It also ...
4
votes
Accepted
dist2Line - Error in dist2Line(...) could not find the function "dist2Line"
In your code none of used packages have this function. That is why R can't find it.
Error in dist2Line(points,line,distfun=distHaversine) : could not find the function "dist2Line"
Probably you want ...
4
votes
Accepted
Points Layer to Distance Matrix QGIS 3.6 - Noosa
The error gives also an answer: convert to single points first. This can be done with the algorithm 'Multipart to singleparts'.
You can link both algorithms in the graphical modeller: processing > ...
4
votes
Accepted
Travel Distance Calculation in QGIS
The question of "what's the best method" is entirely subjective and specific to your situation. The best way to answer this question, in my opinion, is for you to research the different ...
4
votes
Accepted
Calculating distance from centroid points to multiple polygon edges with SpatialLite
Works for me with test data that I created according to your description. I made a successful test both with spatialite_gui program and with QGIS 3.4.4 (see the image). Is the name of your geometry ...
4
votes
Accepted
What is the proper way to calculate distance in km from degrees
Convert your points to UTM first using Rgdal, for example:
dir <- 'C:/your/path'
setwd(dir)#set working directory
pointfile <- 'points.csv'
data <- read.csv(pointfile)#read in data
library(...
4
votes
Calculating distance between consecutive points in same point layer in QGIS
I am not sure if this is the best / fastest way, but I think it should work for you:
length(
make_line(
$geometry,
geometry(
get_feature_by_id('*NAME/ID_of_your_layer*',...
3
votes
Accepted
PostGIS - Calculate of the average distance between points for a delimited area
Sounds like you are looking for ST_DWithin():
SELECT * FROM points as r
LEFT JOIN points as s ON ST_DWithin(s.geom, r.geom, 2);
and this to get the average:
SELECT r.id, s.id, AVG(...
3
votes
Need to get distance matrix for large set of points on-the-fly
Open Source Routing Machine is a project of Open Street Map (OSM) also provides distance matrix results although you may find that a 1k x 1k matrix is pushing it. You can build and install locally or ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
distance-matrix × 176qgis × 105
distance × 37
arcgis-desktop × 16
r × 16
proximity × 15
network × 13
qgis-plugins × 10
point × 10
postgis × 9
coordinate-system × 9
qgis-3 × 8
network-analyst × 7
nearest-neighbor × 7
pyqgis × 6
vector × 5
line × 5
qgis-processing × 5
shortest-path × 5
raster × 4
polygon × 4
pgrouting × 4
latitude-longitude × 4
routing × 4
google-maps-api × 4