Skip to main content

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
0 votes
1 answer
18 views

Distance to nearest non-NA pixel in Google Earth Engine - exported image is pixelated

I am trying to find the distance to nearest mature forest pixel in google earth engine. If I run this code and visualize, it looks perfect: data_folder = "projects/amazon-forest-regrowth/assets&...
Ana Catarina Vitorino's user avatar
4 votes
2 answers
69 views

Change Value of Cell in Cost Layer (Raster) by whether it touches neighbouring cell

QGIS 3.36-Maidenhead: I have compiled a very large cost raster covering parts of Africa. I have applied cost values to all cells based on geographical considerations. I'd like to carry out a final ...
IanGS's user avatar
  • 388
0 votes
1 answer
34 views

Select nearest neighbour by group in R

I have two sets of coordinates, where each pair of coordinates belongs to a group. I'd like to use st_connect to identify the nearest neighbour, but within the group (i.e. nearest neighbour within &...
k42's user avatar
  • 191
1 vote
1 answer
30 views

Connect points to the nearest point that is not inside the same polygon

I am trying to connect points in a vector layer. Each point should be connected to its nearest neighbour that is not inside the same polygon. I am using the ProcessX "nearest point to path" ...
Frannzz's user avatar
  • 11
4 votes
0 answers
189 views

Drawing convex hull that joins centroids of four nearest clusters with highest values

I have point layer in which I have calculated the DBSCAN clusters. The field that stores the clusters is called 'class' and the values range from 1 to 9, plus NULL values. As you can see in the ...
Nil Aspinall's user avatar
3 votes
1 answer
81 views

Dissolve neighbour polygons when distance is below X meters

I like to dissolve polygons in QGIS which are separated by small gaps (streets or paths...). As shown in the picture below, the two polygons in the north should be dissolved, excluding the one in the ...
BAE_23's user avatar
  • 677
1 vote
1 answer
19 views

How to adjust gdaltransform ground control point weighting control?

Let's take a 6 x 6 mile US PLSS township, and house numbers 800 to a mile. Using gdaltransform, given the coordinates of each section corner as our ground control points (-gcp 4800 4800 lon lat for ...
Dan Jacobson's user avatar
0 votes
1 answer
49 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
70 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
295 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
116 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
261 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
44 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
471 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
32 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
295 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
58 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
85 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
255 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
273 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
3k 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
48 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
  • 857
1 vote
0 answers
65 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
  • 851
1 vote
0 answers
327 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
  • 464
1 vote
2 answers
3k 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
450 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
1k 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
  • 464
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
283 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
631 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 ...
Alexander B's user avatar
1 vote
1 answer
194 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
33 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
194 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
505 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
  • 34.9k
0 votes
2 answers
406 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
690 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
407 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
378 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
2k 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
76 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
646 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,049
1 vote
1 answer
861 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
425 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
576 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
160 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
  • 545
2 votes
0 answers
96 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
128 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,143
5 votes
1 answer
939 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

1
2 3 4 5