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 ...
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.
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` ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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:/...
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 ...
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')
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
Use proximity analysis with the near tool.
You could create a cursor in a script or a model to loop through the features.
I think you can:
Convert line vertices to points(line_points).
Make voronoi polygons using the points(line_points).
Dissolve the resulted polygons using either an id attribute which has been saved from line layer, or by a spatial join with line layer.
I hope I have really understood your question, if not can you provide a drawing to explain your needs more....
The FNN package has a function get.knnx which can compute the N-nearest neighbours in point patterns. For what you want, this should work:
nn = get.knnx(A,B,k=1)
Which should just return the nearest neighbors between the two datasets. You can also specify what nearest neighbor algorithm it will use, be it kd_tree, cover_tree, CR, or brute force.
Try Select by Location tool (menu > Selection > Select by Location).
set the target layer, the layer from which the selection to be
made (for example, the point feature)
set the source layer (polygon)
select are within a distance of the source layer feature from the Spatial selection method drop down
set the search distance (100) and unit (meter)
Assuming that you are searching for the closest line edge to your point, you can do a K-Nearest Neighbour (KNN, or 1NN in this case), based on this answer. However you want to use the <#> operator instead, since that operates on the edges of the bounding boxes, rather than the centroids.
FROM public.road_segments r
ORDER BY r.geom <-> ...
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 lines and as polygons. This is what I did. First I converted the polygons to lines using vector/ geometry tools/polygon to lines. Now I did have all my rivers ...
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 ...
Buffer points - dissolve = none:
Notice that ArcGIS has added the first field in the list 'Join_Count'. This will record how many POIs intersect the Buffers. The attribute table of the spatial join output will have all your attributes from the points, as well as the join count.
Export the spatial join result to excel and clean up the table.
I don't know of any easy way to do this in QGIS, but it can be very quickly done in PostGIS. Say you install Postgres and PostGIS, and import your points layer as "centroid", and polygon layer as "neighbourhood". This is the query you'd then execute:
SELECT c.id AS centroid_id, n.id AS neighbourhood_id, k.dist AS distance
FROM centroid as c
JOIN LATERAL (...
just put the select qry in a cte and add the id column and join to the update clause
with a as(SELECT ST_ClosestPoint(lines.geom, points.geom) as snapped_point,points.id id
INNER JOIN points on ST_Dwithin(lines.geom, points.geom, 5)
ORDER BY points.id)
SET geom = snapped_point from a where points.id=a.id
I'm going to credit @Geoist with the answer to this question, based on his comment above (NOTE: if you repost your comments as an answer, I will give you the "accepted mark").
As it turns out, the issue was in trying to run the NEAR analysis against the personal geodatabase on a network drive. As soon as I changed the source to an ArcSDE or file on the ...
This is a bit old, but I was searching for solutions to this problem today (point --> line). The simplest solution I've come across for this related problem is:
>>> from shapely.geometry import Point, LineString
>>> line = LineString([(0, 0), (1, 1), (2, 2)])
>>> point = Point(0.3, 0.7)
POINT (0.3000000000000000 ...