32

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 ...


23

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 ...


13

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 UPDATE gps SET stop_id = ( SELECT stops.stop_id FROM stops ORDER BY gps.geom <-> stops.geom LIMIT 1 ) ; [*] Just to give an example ...


12

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` ...


12

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. ...


11

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)...


10

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 ...


10

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[0].geometry().buffer(100, -1) #erasing selected feature in original list del feats[0] new_feats = [feat for feat in ...


10

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 ...


9

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 ...


9

This should be possible without any plugin using the default Processing tools, particularly Distance to nearest hub: https://docs.qgis.org/testing/en/docs/user_manual/processing_algs/qgis/vectoranalysis.html#qgisdistancetonearesthublinetohub


8

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 ...


8

While in general this would be better handled in PostGIS, there are plug-ins which do the heavy lifting for you: NNJoin MMQGis Hub Distance. NNJoin 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 ...


8

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 ...


8

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')[0] addrlyr = QgsProject.instance().mapLayersByName('ADDRESS')[0] #List ...


7

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 ...


7

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 FROM signalstrengths ORDER BY st_distance(st_makepoint(:lng, :lat)::geography, point) DESC LIMIT 1; What you want is, SELECT point, strength FROM signalstrengths ORDER BY st_distance(...


7

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 ...


7

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 ...


6

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 ...


6

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: import arcpy,math # Set variables for input point feature classes and output table ptFC1 = "C:/temp/test.gdb/PointFC1" ptFC2 = "C:/temp/test.gdb/PointFC2" outGDB = "C:/...


6

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 ...


6

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 ...


6

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 ...


6

For qgis 3.8 and later you can use "join by nearest" from the processing toolbox.


6

You can try a Virtual Table of the Data Source Manager like this: select p.myid, l.myid, min(st_distance(p.geometry, l.geometry)) dist from mypoints p, mylines l group by p.myid; 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 ...


6

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 ...


6

You can use the spatial join tool and specify an appropriate distance. That will add the attributes to the feature.


6

The following expression should work : array_to_string(overlay_nearest('Streets', StreetNameField)) Adapt the expression to your data structure. From QGIS 3.16 on, i think.


5

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 ...


Only top voted, non community-wiki answers of a minimum length are eligible