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
-2 votes
0 answers
41 views

Distance to the nearest hub but determined by the road network

I'm just learning QGIS. I have a point layer of localities. A point layer of specific POIs. Linear layer of the road network. There are approximately 40,000 towns and approximately 5,000 POIs. I would ...
jdsz's user avatar
  • 1
0 votes
1 answer
48 views

Merging thick boundaries with individual districts

I have this shapefile of Akron's city council districts in 2010. For some reason the boundary lines are very large. What would be the simplest way of combining the with the nearest district? If the ...
ericandrethegiant's user avatar
1 vote
2 answers
66 views

Finding features of connected lines to simplify line elements

I have a dataset of spatial line element where each line is classified as a certain vegetation type. The issue is that there are quite few instances where different vegetation types are recorded for ...
Nick's user avatar
  • 85
3 votes
2 answers
283 views

How to draw 8 lines away from every point in a layer using QGIS?

In QGIS I have a layer of many points, and I am trying to draw 8 lines of radius, r, from each point outwards, in the eight windrose directions (N, NE, .. etc). What is one method that can be used to ...
p1unge's user avatar
  • 109
4 votes
1 answer
97 views

Finding nearest body of water (polygons) in the eight windrose directions from a point using QGIS?

I have a layer of points, and a layer of bodies of water (polygon). I am trying to find then nearest 8 bodies of water, in the 8 windrose directions (N, NE, E, SE, S, SW, W, NW) within a given radius. ...
p1unge's user avatar
  • 109
1 vote
1 answer
154 views

Warning message when doing spatial join nearest neighbor on GeoPandas

I am trying a nearest neighbor spatial join with two point Geodataframes but a warning message is appearing. My code: import geopandas as gpd yield_2013=gpd.read_file('https://github.com/kevinkuranyi/...
Oalvinegro's user avatar
0 votes
0 answers
37 views

How to do Neighborhood Summary Statistics by Year in ArcGIS Pro

I am attempting to calculate neighborhood summary statistics for groups of administrative polygons for each year between 2002 and 2018 in ArcGIS Pro. In ArcGIS Pro the Neighborhood Summary Statistics ...
Matt's user avatar
  • 93
6 votes
2 answers
362 views

Finding the nearest named highway way id

Given my location (in Bochum city, Germany), I am trying to identify the nearest highway way id by using the following Overpass API query: [out:json][timeout:180]; area[name="Deutschland"]; ...
Alexander Farber's user avatar
1 vote
0 answers
28 views

Raster stack values mostly NA but in ArcGIS Pro hardly any NA values in extent

I am predicting a machine learning model onto a set of continuous and categorical spatial explanatory variables in R. When I take a look at the raster stack (called Ras1) values using: values(Ras1) ...
BHope's user avatar
  • 63
5 votes
2 answers
149 views

How to calculate distance to nearest neighbor when new candidates are created over the years?

I want to calculate distances between sold properties and the nearest wind power turbine over the years 2013-2022, in FME. QGIS is also an option. I have coordinates for them both and also dates for ...
Josefin's user avatar
  • 51
0 votes
0 answers
47 views

Spatial neighbors to voxels for R-INLA

I am working on an fMRI dataset that I want to analyse using a Bayesian spatial model in R-INLA. I extracted the coordinates for all these voxels. (See the image to get an impression one such a ...
BasMts's user avatar
  • 1
0 votes
1 answer
78 views

Finding two nearest line features to each point

I am using ArcMap I have hundreds of points as a point shape file and also a polyline feature class as another shape file. Problem: I need to know two most nearest polyline IDs to each point. What I ...
sadra imanyfar's user avatar
0 votes
1 answer
223 views

Radius in nn2() in RANN package

I was trying to use the solution offered here to find all the location from df which are within the 70 km distance from my point of interest userLocation=c(6.9,55,2), but it does not work properly. ...
Haribo's user avatar
  • 115
1 vote
0 answers
223 views

Find nearest neighbor between meshgrid of lats and lons

Let's say I have a Polar dataset in which I run a projection on to get latitude and longitude values: # Convert to Cartesian x = allrange * np.sin(np.deg2rad(azimuth))[:,None] y = allrange * np.cos(np....
Miss_Orchid's user avatar
0 votes
1 answer
2k views

QGIS 3.26.3 DEM Application Natural Neighbour is missing in the menu

I want to create a DEM and contours for a architecture site with QGIS. Half a year ago everything worked perfectly fine. Now natural neighbour is just missing in the toolbox. I got the newest version ...
ArchGis's user avatar
  • 11
1 vote
1 answer
44 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 ...
analyst92's user avatar
  • 837
1 vote
0 answers
62 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 ...
Wilcar's user avatar
  • 841
1 vote
0 answers
296 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" ...
Rii Pii's user avatar
  • 411
1 vote
2 answers
2k 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 ...
KMad534's user avatar
  • 13
8 votes
2 answers
437 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 ...
Obie K's user avatar
  • 375
3 votes
1 answer
844 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 ...
Rii Pii's user avatar
  • 411
1 vote
0 answers
28 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 ...
boydo's user avatar
  • 75
0 votes
1 answer
242 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 ...
user209540's user avatar
1 vote
2 answers
546 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 ...
B Alexander's user avatar
1 vote
1 answer
181 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 ...
Amelia Nicodemus's user avatar
1 vote
0 answers
32 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 ...
GIRMAR's user avatar
  • 11
-2 votes
1 answer
166 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 ...
user38747's user avatar
3 votes
2 answers
414 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 ...
MrXsquared's user avatar
  • 33.8k
0 votes
2 answers
374 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 ...
fuzzy_raster9873's user avatar
4 votes
2 answers
595 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 ...
dabba293's user avatar
2 votes
1 answer
342 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 ...
peppie's user avatar
  • 59
2 votes
1 answer
2k 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 ...
Rachel K.'s user avatar
2 votes
1 answer
341 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 ...
Andre's user avatar
  • 21
2 votes
1 answer
1k 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, ...
Vico's user avatar
  • 51
1 vote
0 answers
72 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 ...
nn90's user avatar
  • 57
4 votes
2 answers
520 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 ...
Geographos's user avatar
  • 4,077
1 vote
1 answer
739 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 ...
JiannisK's user avatar
1 vote
1 answer
379 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 ...
m2rik's user avatar
  • 111
2 votes
3 answers
1k 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 ...
BO-GIS's user avatar
  • 23
2 votes
1 answer
560 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 ...
mira's user avatar
  • 29
2 votes
0 answers
136 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 ...
Erioderma's user avatar
  • 515
2 votes
0 answers
89 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 ...
Cheryl Day's user avatar
1 vote
0 answers
114 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 ...
Encomium's user avatar
  • 3,113
5 votes
1 answer
838 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 ...
richard.turner's user avatar
4 votes
4 answers
1k 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 (...
Monitotier's user avatar
5 votes
1 answer
194 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 ...
andrewdawes07's user avatar
4 votes
2 answers
159 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 ...
Katja's user avatar
  • 65
4 votes
1 answer
704 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. ...
Rehan Ahmed's user avatar
2 votes
1 answer
640 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 ...
Ishan Srivastava's user avatar
0 votes
2 answers
124 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 ...
Wangcincay's user avatar

1
2 3 4 5