Questions tagged [nearest-neighbor]

A technique for resampling raster data in which the value of each cell in an output raster is calculated using the value of the nearest cell in an input raster.

Filter by
Sorted by
Tagged with
1 vote
1 answer
20 views

Limitations of K-NN operator

Can the K-NN operator <-> be used to find nearest neighbors when comparing ANY geometry type (point, linestring, polygon etc.) with ANY other geometry type, or are there any limitations? It ...
  • 447
1 vote
0 answers
40 views

Batch shorter path QGIS (Snow map)

I'm working on the famous John Snow map about cholera in Soho, London with QGIS I use the data from Don Boyes and I extracted the street network from OpenStreetMap. I have : a layer of pumps a ...
  • 735
1 vote
0 answers
32 views

QGIS Geometry Generator make_line using road network

I want in QGIS 3.22 Geometry Generator to connect related points with a line, but the line must go between the points along the shortest network of paths. I have two layers: one is "points" ...
  • 381
1 vote
2 answers
128 views

R - Finding closest point to each point and filtering which points to consider

I'm a beginner in R. I am working in R with a dataset of bird nest locations and am interested in the distribution of said nests. Specifically, I'd like to find the closest neighbor to each nest as ...
  • 13
8 votes
2 answers
373 views

Nearest polygon that differs on an attribute

I have two polygon layers: city blocks (black outlines) and city zones (multi-colored areas) shown below. I would like to find for each city block, the nearest block that is in a different zone. I've ...
  • 365
3 votes
1 answer
109 views

Using QGIS expression with overlay_nearest() function to create line connecting point to two nearest points of other layer

I have in QGIS ver 3.22 two point layers named: source_p target_p I want to point automatically with a line from the source_p layer to the two nearest points on the target_p layer. Manually, I was ...
  • 381
1 vote
0 answers
15 views

k number and distance for automating mesh network of electric service poles

I'm using QGIS to try to make an analysis for placing electric utilities poles for the first time. I've imported building and road info from OpenStreetMap and have tried some things with nearest hub ...
  • 43
0 votes
1 answer
53 views

How to identify the closest point in a single layer?

I am new to GIS. I have multiple coordinates of places from Safegraph. I believe there are some duplicates in my file (they have different IDs, but they seem to be identical places based on their ...
1 vote
2 answers
67 views

How to find more than one nearest neighbour in an X,Y layer

I have successfully fount nearest X,Y point in one GeoPandas data frame to the other X,Y points in the second GeoPandas data frame. My questions is on how to find the second nearest point or (third ...
1 vote
1 answer
55 views

Systematic sampling (points selection) based on distance

I have a points layer within a buffer derived from a transect. I need to sample a specified number of points, and ideally systematically based on distance. I have calculated the distances from a ...
1 vote
0 answers
26 views

Neighboring zones using a condition (expression)

We have a census tract layer which contains the total number of dwellings 'V_tot'. We need to group the census zones that intersect each other where their sum is in the range of greater than 150 and ...
  • 11
-2 votes
1 answer
62 views

Space time nearest neighbor [closed]

I have a dataset with 3 coordinates time, latitude and longitude. How can I compute the nearest neighbor point for each point in the dataset using the 3 coordinates? I'm using Python but I can't ...
3 votes
2 answers
130 views

Finding nearest polygon in PyQGIS using QgsSpatialIndex

I am trying to write a custom processing tool for QGIS which joins the nearest attributes with some conditions. Therefore I'd like to use a QgsSpatialIndex to increase performance. This works ...
  • 27.3k
0 votes
2 answers
106 views

Any Python modules with an equivalent to ArcGIS Pro "Average Nearest Neighbour Distance" tool?

ArcGIS Pro offers the Average Nearest Neighbour Distance geoprocessing tool to measure the distance between each feature centroid and its nearest neighbour's centroid location. It then averages all ...
3 votes
2 answers
208 views

Looking for Python equivalent of QGIS "Nearest Neighbour analysis" tool

I've been using QGIS "Nearest Neighbour analysis" tool to find out the following information about my point shapefile Observed mean distance Expected mean distance Nearest neighbour index ...
2 votes
1 answer
131 views

Distance to nearest shape in Python

I have a shapefile containing multiple polygons of protected zones, I try to compute a raster with, for each pixel, the distance to the nearest protected zone. I've been able to obtain it with QGIS ...
  • 39
2 votes
1 answer
467 views

Identifying n-nearest polygons to point in GeoPandas

I have a dataset of fire polygons, and a user inputted lat/lon coordinate. I'm hoping to write a function to subset the 3 nearest polygons to the inputted coordinate, in order to report out their ...
2 votes
1 answer
118 views

Aggregate points inside polygons

I have a project that I am required to aggregate points inside polygons that have a common value. Basically having QGIS to create a buffer around those points. The dark green arrows have a unique ...
  • 21
2 votes
1 answer
256 views

QGIS georeferencing leads to wrong position

I'm trying to georeference a TIFF file in QGIS (version 3.20.0-Odense) based on a WMS layer (EPSG:4326). The project is in EPSG: 25832 and I used the same as output for the georeferencing (4 points, ...
  • 31
1 vote
0 answers
31 views

Categorical raster values to points are incorrect near edges

I have a vector point layer, and a low-res, categorical raster. The raster is a map of habitat type, and it is in the form of a single-band which ranges from 1-55 where each number is a different ...
  • 29
3 votes
2 answers
208 views

QGIS pick up certain value from the nearest neighbour object

I have a set of addresses defined by the green dot. I have also objects (poles) to which I would like to assign the address (3-4 data attribute columns) from the nearest address point (green). I ...
  • 3,531
1 vote
1 answer
208 views

Calculating average attribute value of neighbour grids based on location and applying it to grid cells in QGIS

I have a grid dataset of 2.5km grid-cells and want to calculate the average of some attributes for each of the eight adjacent cells to the central one (nine cells forming a square). So the calculation ...
1 vote
1 answer
129 views

Difference between SDO_NN and BallTree Sklearn for Nearest Neighbors

I am trying to find nearest n/w nodes from multiple buildings in an area, I have 2 geodataframes/Tables in Oracle DB, buildings have point geometries with ID's and Nodes have point geometries with ...
  • 111
2 votes
3 answers
480 views

Get nearest neighbour on same or another layer to connect points by drawin a line in QGIS

In my project I try to find the shortest way from a point to a specific line (street). Fortunately, this is no big deal in QGIS 3.0 using "Points along lines" and "Distance to Nearest ...
  • 23
2 votes
1 answer
461 views

Fastest way to extract the neighbours of a GPS point among millions of other points?

I have millions of GPS point located in the same city. I would like to make spatial bins that contain adjacent points together (GPS points that are within a specific range of each other). I have a ...
  • 29
0 votes
0 answers
29 views

Reverse-engineering a drivetime map

I recently came across a map on a Reddit site showing the closest MLB stadium by drivetime across the US. I've seen maps before that show a polygon around a point that represents a given driving ...
  • 374
0 votes
0 answers
60 views

Iterating over two very large dataframes: finding the closest LineString (1/150k) to a Point (1/1.2m)

I have a dataset of calls (1.2m rows), each with a 'Point' geometry. Likewise I have a street dataset (150k rows), each with a LineString geometry. My goal is to identify, for each call, the closest ...
2 votes
0 answers
68 views

Depth To Water Index - How to Extend the Wetland Boundary Based on Parameters

I recently reached out to ask about how to develop a Cartographic Depth-to-Water index (DTW) following the methods described in the paper below: Using the Cartographic Depth-to-Water Index to Locate ...
  • 385
2 votes
0 answers
38 views

QGIS Field calculator preview is different to field value when identifying neighbor polygons to list and count in attribute field?

I am using Field Calculator to identify neighboring polygons and count them. However, the Field Calculator preview value is not the value going into the Attribute field (as per images), unless only ...
1 vote
0 answers
38 views

GeoPackage: Nearest point from another table

I'm trying to use GeoPackages rather than PostGIS when teaching introductory classes, and that inevitably involves conversions between SQL variants. This time, I'm not able to get to a version of a ...
  • 2,799
4 votes
1 answer
312 views

How to assign a neighbour status to unlinked polygons

This question is, in part, a follow up to: https://stackoverflow.com/questions/57269254/how-to-impute-missing-neighbours-of-a-spatial-weight-matrix-queen-contiguity I have a .shp similar in structure ...
4 votes
4 answers
427 views

How to find neighboring polygons which share a common feature in ArcMap 10.4?

I am currently using ArcMap 10.4. My task is to find which polygons share a border given a specific feature. I would like to automate this workflow. For instance, I have 2 polygon feature dataset (...
4 votes
1 answer
90 views

Nearest neighbor analysis to pick the next closest waypoint

I'm looking for a QGIS solution to do a nearest neighbor analysis on a set of waypoints that I have as X Y points. When the points are loaded into the planning software (loaded as waypoints) they draw ...
3 votes
2 answers
74 views

Clustering vectorpoints

I created a layer of vector points out of a raster. The raster was a .png, where I extracted all the pixels with the value 1. Initially, it was a Paper, where I marked points with a pen. Now I am ...
  • 55
4 votes
1 answer
212 views

ST_DWithin is returning all the data in the table

I am new to PostGIS and currently struggling with ST_DWithin function. I have a table stores, which stores lat and long of locations in Denmark in the location column as geometry and with SRID 4326. ...
2 votes
1 answer
279 views

QGIS spatial analysis grid nearest neighbour ERROR 4 No such file or directory Process returned error code 1

Whenever I try to run some form of spatial analysis by raster>>analysis>>Grid (Nearest Neighbour) or Grid (Inverse Distance to a Power) I am hit with the errors and message logs below. I ...
0 votes
2 answers
76 views

What tool do I need to visualize world map with straight border while keeping its area and neighboring countries

I am fairly new to data visualization. My goal is: Turning country area into right angled polygon with same area Keeping the neighboring country tangent to its new border Finding the new arrangement ...
1 vote
1 answer
176 views

The distance between the points of two layers

I have 3 layers in QGIS (shapefiles) : two point layers : Houses and fire hydrants and one line layer : Road I want to calculate the shortest distance between each fire hydrant and a house using the ...
  • 13
0 votes
0 answers
21 views

Finding Average Nearest Neighbor when multiple points are stacked with similar XYZ

I routinely run the average nearest neighbor tool in ArcGIS Pro but I do a lot of front end massaging my points file. My current workflow: I generate multiple points that run down a single drill hole ...
  • 56
2 votes
1 answer
57 views

Duplicates Not Highlighted

Actually I am using Geometry Generator and a small script for displaying duplicate values in the data. But some duplications are not highlighted. Don't know why its happening. can any one suggest any ...
  • 269
2 votes
1 answer
327 views

replacing missing values with the most common pixel closeby [QGIS]

Hi I made classification map which you can see below. Because the original map had text in it and some borders etc that I didn't want to be included in the new map, these got their own class and ...
  • 23
0 votes
1 answer
176 views

QGIS Nearest neighbour analysis with GeoTIFF

I need to perform something similar to the ArcGIS tool for neighbourhood analysis (Toolbox>Spatial Analyst Tools>Neighorhood>Focal Statistics). But for nearest neighbor in QGIS I need a ...
  • 85
2 votes
1 answer
109 views

Find nearest neighbour for set of points [duplicate]

Using PostgreSQL and PostGIS. I have two sets of point data (geoms), one is a node graph indicating roads and the other represents street crossings. For my set of crossing data I want to find the ...
3 votes
1 answer
162 views

Setting the study area boundaries in QGIS for nearest neighbor analysis?

I've made a cursory (i.e., two hour) search of the Stack Exchange and the Internet to find out how we can set the study area boundary for the nearest neighbor analysis command in QGIS 3.16. Sadly, I ...
1 vote
1 answer
379 views

Cell size in Grid (Nearest Neighbour) in QGIS

I am using Grid (Nearest Neighbour) in QGIS to obtain raster layer from point shapefile. However, on execution of the tool and obtaining the output, the default resolution of cell is 62 m. However, I ...
0 votes
0 answers
21 views

How print nearest object?

I have point on map. I want found nearest object. Code works perfect. System show 1 occurence. But how get it? point = arcpy.Point(5285360.478599999, 5310336.491400003) ptGeometry = arcpy....
0 votes
2 answers
32 views

v.surf.idw failling with "Killed" message on GRASS 7.8.2

I have a categorical raster with gaps that I would like to fill using a nearest neighbour interpolation. The r.fill.gaps module does not implement this interpolation method so I am trying a manual ...
1 vote
0 answers
24 views

Adding nearest point-(features) to attribute table

Using QGIS I'd like to add the (10) nearest random points, that I created within a polygon, to a target point and have their distances to said point added to that point's attribute table. I'd like to ...
  • 59
4 votes
1 answer
85 views

Label neighbouring features in QGIS

In QGIS I'm trying to label the neighbouring features of a certain polygon but not getting much success. All the features are inside the same layer named MG_Municipios_2020. I'm using the Rule-Based ...
  • 1,064
0 votes
1 answer
34 views

Composite layer by distance

I've got a complicated problem right now. I have a layer with polygons and use the tool "Closest Neighbor" to find all Polygons that have a neighbor within 10 meters. That works fine, but ...

1
2 3 4 5