Absolutely you can. And it can be quite fast. (The intensive computation bits can ALSO be distributed)
There are several ways, but one way that I've been working with is in using an ordered list of integer-based geohashes, and finding all the nearest neighbour geohash ranges for a specific geohash resolution (the resolution approximates your distance ...
As an alternative, you could:
Use the Convert Lines to Points tool from:
Processing Toolbox > SAGA > Shapes - Points > Convert Lines to Points
(Add points over small distances. E.g. add a point every 1m if the overall line is 100m)
Use the Distance to nearest hub from:
Processing Toolbox > QGIS geoalgorithms > Vector analysis tools > Distance to nearest ...
No need for JOIN LATERAL (or do you really just want to use it?); an UPDATE will pass each processing row to the following query, which is the same concept as using a JOIN LATERAL.[*]Try
SET stop_id = (
gps.geom <-> stops.geom
[*] Just to give an example ...
Let's break this down into simple pieces. By doing so, all the work is accomplished in just a half dozen lines of easily tested code.
First, you will need to compute distances. Because the data are in geographic coordinates, here is a function to compute distances on a spherical datum (using the Haversine formula):
# Spherical distance.
# `x` and `y` ...
To illustrate a raster/image processing solution, I began with the posted image. It is of much lower quality than the original data, due to the superposition of blue dots, gray lines, colored regions, and text; and the thickening of the original red lines. As such it presents a challenge: nevertheless, we can still obtain Voronoi cells with high accuracy.
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 first impression about spatial distribution.
You could also create a Heatmap as raster layer with Menu Processing / Toolbox / Heatmap (Kernel density estimation)...
Here is a python solution, using arcpy to access the data and numpy to calculate the statistical values.
Using arcpy.da.SearchCursor() write the values to a list. Use python.numpy.percentile() to find the threshold percentile values that you want to use to identify outliers, lets take your example and drop the lowest 10% and highest 10% of values.
If you ...
If you want to select all features that are within 100 m of the selected "buffer" feature you can use next code:
layer = iface.activeLayer()
feats = [ feat for feat in layer.getFeatures() ]
#selected feature fid = 0
geom_buffer = feats.geometry().buffer(100, -1)
#erasing selected feature in original list
new_feats = [feat for feat in ...
You can use QGIS expressions with the new overlay_nearest function, availble since QGIS 3.16 and the array_mean() function, available since QGIS 3.18.
If you already have an attribute in the polygon layer (lets say with fieldname values), than applying this epxression on the polygon layer with field calculator will get you the mean value of the neighboring ...
the grass algorithm v.net.alloc can produce the subnets - you can call it from the Processing toolbox (tested in QGIS 2.16)
You'll need a point layer (for facilities) and a lines layer with costs (either time/length). It'll create a new line layer with a field called cat added, which will be the id of the nearest facility.
Here's an example based on ...
This should be possible without any plugin using the default Processing tools, particularly Distance to nearest hub:
The resampling method 'near' or 'nearest' is generally to be considered only for succinct/classified data, it attempts to assign a cell value based on the closest source pixel:
This is most commonly integer (int8, int32, int64) types but can be of type float (float32, float64) where each cell represnts classified values and generally values appear more than ...
While in general this would be better handled in PostGIS, there are plug-ins which do the heavy lifting for you:
MMQGis Hub Distance.
This is the preferable and correct way, however could be slow on large datasets.
It has the non trivial advantage to compute the correct polygon-to-line distance, without converting buildings into points ...
As I understand it, v.neighbors outputs a raster that can hold the number of points within a set distance from each cell, but does not identify whether or not the points themselves have any neighbours (see the manual page).
Anyway, instead you could try a clustering tool, for example DBSCAN clustering. Set the minimum cluster size to 2 and maximum distance ...
This is not taking any attributes into account (for example road name stored in each address point), just finds closest road using closestSegmentWithContext. Then you can merge (or spatial join etc.) output lines with your roads.
roadlyr = QgsProject.instance().mapLayersByName('TR_ROAD')
addrlyr = QgsProject.instance().mapLayersByName('ADDRESS')
The NNJoin QGIS Plugin finds the closest line for each point. The resulting point layer will for each point contain the distance to the closest line and all of the attributes of that line.
NNJoin calculates the single nearest feature to each input feature. NNJoin works both between two different layers and within a single layer. To find the nearest ...
As @ziggy said in the comments,
"shouldnt it be asc if you trying to find the closest point?"
Your code is not correct (reproduced below),
SELECT point, strength
ORDER BY st_distance(st_makepoint(:lng, :lat)::geography, point) DESC
What you want is,
SELECT point, strength
ORDER BY st_distance(...
I guess it is the centre of triangle excircle with largest radius, that touches no more than 3 points. In the picture below first 11 such centeres shown. They are labelled by their ranking number.
It is enough to weed out ones that are outside triangles and define the champion, i.e. No3 in the picture.
UPDATE INSPIRED BY STEVEN FINDING:
Result above ...
In the Processing Toolbox use the Vector general > Join attributes by nearest tool with the following settings:
Input layer = your point layer
Input layer 2 = your line layer
Layer 2 fields to copy: Any you need, only choose the line layer ID if you want to keep the number of attributes down
Other settings can be left as default.
The result will be a ...
You can't give your existing cells a distance to the line feature as in the Point Distance tool for vector points.
You can, however, calculate a new raster of distances to the line feature using the Euclidean Distance tool.
You will have to ensure that you sent your cell size and snap raster to the original raster, so you get essentially a new raster with ...
The following code is not polished but should work to create the same output table as the Point Distance tool but requires ArcGIS 10.1 (or later) for Desktop and only a Basic level license:
# Set variables for input point feature classes and output table
ptFC1 = "C:/temp/test.gdb/PointFC1"
ptFC2 = "C:/temp/test.gdb/PointFC2"
outGDB = "C:/...
In QGIS I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer....
Let's assume we have two layers 'points' and 'river' with its corresponding attribute tables, see image below.
With the following query, it is possible to create new lines that will represent the connection between points to the nearest line ...
In order to calculate the nearest distance of polygon features to your points (not using QGIS or anything in the proximity toolbox), you could perform a spatial join. You should choose CLOSEST for your match option and add a descriptor for your distance field name which is what will be filled with your near distances.
This will work well for all of your ...
Here's a follow-up. Thanks to @FelixIP for pointing me in the right direction!
Using the OSM data from Australia, I was able to find the "point of inaccessibility" on the Australian Mainland - I make it around 260km equidistant from Akarnenehe, Bedourie, and Mount Dare, at POINT(137.234888 -24.966466)
I found a fairly easy workflow in QGIS which uses a ...
You can try a Virtual Table of the Data Source Manager like this:
min(st_distance(p.geometry, l.geometry)) dist
mypoints p, mylines l
Where mypoint and mylines are replaced by your table names and myid by your id columns.
This code will return, for every point, the line id and distance of the ...
Add a field named YOL_NAME to Kapi layer, select a feature, then run the following script. (First, backup Kapi and Yol layer data sources)
yol_layer = "Yol"
yol_name_field = "AD" # yol name field in yol layer
kapi_layer = "Kapi"
kapi_yol_field = "YOL_NAME" # newly added yol name field in kapi layer to be populated
It turns out I need to use ST_DWithin to narrow down the scope of the search and prevent the query from performing a sequential scan on the entire bigger table on every iteration.
This is what I ended up using and takes only around 20 seconds to run on the entire table:
UPDATE nbi.testpoints SET closenbicount = (SELECT count(1) FROM nbi.bridges WHERE