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
12
votes
2answers
27k views

Find closest lat long to an input lat long (SQL Server 2008)

I have a point cloud in my database (SQL Server 2008 spatial). That is about 6 million records. There are 3 columns: id, value, geom. What is the optimal way of getting the 'value' at input lat long?? ...
3
votes
1answer
98 views

Linking points and line layers

I have a points layer and a polyline layer. The points layer is basically bus stops and the line layer is the road network. The bus stops may or may not fall exactly on the road network layer. I want ...
0
votes
0answers
20 views

How to evaluate the statistic significance in the Neighbour Nearest Test?

I'm reviewing a scientific article to be publish. I tried to evidence that pathogens collected from different geographic areas clustered. I used Nearest Neighbour test to prove it. However, I've ...
1
vote
1answer
970 views

Nearest neighbor analysis not showing results

I'm trying to do a nearest neighbour analysis on fish shoals distribution. I go to Vector > Analysis Tools > Nearest neighbour analysis. I choose the appropriate layer and when I hit ok the black ...
0
votes
2answers
48 views

QGIS: Lines between multiple nearest neighbors

So I have a set of hubs and spokes and want to connect each spoke to its three nearest hubs. I used the distance matrix method (Returning Multiple Nearest Neighbors) and now I have a (MultiPoint) shp-...
5
votes
2answers
750 views

Returning Multiple Nearest Neighbors

I'm trying to replicate a nearest-neighbor analysis that returns X (one OR more than one) neighbors in either QGIS or PyQGIS. For example: In this output, I have a set of locations (Red Stars) that ...
1
vote
0answers
24 views

Nearest Neighbor Global matching

I'm trying to compare two datasets; a satellite image and some known points. In the satellite image I've got 20 to 50 detections that should match up to a set of lat/lon points that I have. There is ...
1
vote
1answer
41 views

Cut hole in raster with shapefile and sample at closest edges

I have a raster in which I'd like to cut a "hole" with a shapefile. I have points close to the boundary, but inside the hole, and I would like to find the closest point on the edge. To give a concrete ...
0
votes
0answers
12 views

What percent of non-zero weights should I aim for when selecting value of k?

I am attempting to test for spatial-autocorrelation among regression residuals via Moran's I in R using the 'spdep' package. While creating the spatial weights, changing the value of k changes the ...
1
vote
1answer
158 views

Error creating DEM with Nearest Neighbour tool in QGIS?

I have an issue when I am creating a DEM with the tool natural neighbour on QGIS. When I extract my data directly on Qgis I have no issue creating a DEM. My points are coming from different sources ...
0
votes
1answer
33 views

Seeking package/function in R that can help tag GPS coordinates of fauna sightings to nearest sampling point?

I have 1 dataset of animals sighted walking a survey, and I would like to tag them to the respective sampling points along a transect. Any idea what function/package in R can do that? Maybe ...
0
votes
1answer
292 views

Nearest Neighbor - return object ID in R

I have a csv file that contains the GPS coordinates of about 100 villages and their unique ID. I have an other csv file with the GPS coordinates of some potential destinations and their unique ID. I ...
1
vote
0answers
75 views

Nearest neighbours with Python [closed]

I'm learning Python and this has been a bit of a challenge! My DataFrame looks like this below. name geometry 0 Uimastadion POINT (24.93045 60.18882) 1 Hartwall ...
3
votes
2answers
924 views

Finding nearest neighbor with PostGIS and nodejs

I'm using postgreSQL 9.1 , postGIS 2.0, nodejs 0.10.12 and the latest version of node's pg module. I use websockets on the server side. I implemented a function that tries to find the 5 nearest ...
2
votes
1answer
96 views

R {spdep} Get list of neighbors from nb object

I want to identify the specific neighbors of each polygon within a SpatialPolygonDataFrame from nb object. I know I can get the number of neighbors by polygon id by card(nb), but how to get the list ...
1
vote
1answer
161 views

How to find closest point on a line from a point in Oracle Spatial?

I want to find the nearest point on a line from a point in Oracle Spatial. I know how to do in SQL Server and PostgreSQL but could not find anything about Oracle. I have used MDSYS.sdo_nn to find the ...
4
votes
1answer
74 views

QGIS - How to find the distance for the nearest polygon from point for a defined angle?

I'm using QGIS 3.1 and I want to find the distance from a point to the nearest polygon for a given direction. So for example, for each point in my point layer I want to find the distance to nearest ...
1
vote
1answer
63 views

How to find nearest neighbor in Oracle's ST_GEOMETRY?

I am trying to find nearest road segment to a point in Oracle. I can do this with SDO_GEOMETRY type i.e select /*+ LEADING(pois) INDEX(route ALL_ROUTES_SPTAIL_INDEX) */ route.* from DEVICE_STATUS ...
24
votes
5answers
29k views

PostGIS nearest points with ST_Distance, kNN

I need to obtain on each element on one table the closest point of another table. The first table contains traffic signs and the second one the Entrance Halls of the town. The thing is that I can't ...
1
vote
1answer
511 views

Spatial Join in CartoDB

I need to update a table of points with the FIP code of the nearest county polygon from a separate table. I've managed to update the column for those points that Intersect a county polygon with this: ...
1
vote
0answers
28 views

Distance Point x,i from nearest Point x,j report Point x,j ID in r

I have a sample of points villages x,i, and I want to know the distance between each village x,i and the nearest village x,j. The i, and j depicts two different samples. I am able to find the distance ...
2
votes
1answer
895 views

Nearest Neighbor Analysis Results

I'm fairly new and entirely self-taught in using QGIS 3.4. I'm looking at turtle nest sites and trying to run a nearest neighbor analysis to analyze their distribution and establish whether or not ...
0
votes
0answers
12 views

Linking clusters and masks by a common identifier

In ArcMap, I have raster clusters with unique identifiers. Around each cluster I have masks. Is there any way to carry each of the clusters' identifiers over to the attribute table of its closest ...
1
vote
1answer
37 views

ST_ClosestPoint() moves all points to one line instead of closest line

I have a line network and I've created evenly-spaced points along those lines. The problem is that the points are not exactly on the line so subsequent overlay operations will not work as expected. I'...
2
votes
1answer
222 views

Spatial 1 to 1 join by proximity in sf and R?

I'm trying to join a Simple Feature of POINT geometry type to another Simple Feature of POLYGON geometry type using st_join and nngeo::st_nn as the person asking this other question also did. The ...
7
votes
1answer
225 views

Rockfall analysis (Nearest neighbor downhill) in QGIS

I am working on a rockfall guide for QGIS and I'm currently stuck on one of the stages. I currently at a point in the guide where I have two point layers one "rockfall release point"-layer and "...
1
vote
1answer
32 views

Nearest Neighbor Two Point Tables Return Line Geometry

I am looking to find the nearest neighbor between two point tables in PostGIS and return the ids of both along with the line geometry. I have been able to determine the distance for the nearest ...
0
votes
0answers
32 views

Nearest Neighbour along a route instead of geographical displacement

Say that I have three layers as follows for a certain region: Line Layer representing roads Point Layer representing hotels Point Layer representing train stations Using QGIS is there a way in which ...
2
votes
1answer
82 views

ST_Distance does not give nearest node

I am trying to find the nearest point on the road network closest to a given point. I imported the road network into PostGIS from QGIS and am using the SQL window in QGIS DB Manager to query the road ...
1
vote
1answer
78 views

Distinct st_shortestline

I have 61 pts and numerous rds. I would like to find the shortest distance to the nearest road using st_shortestline. I need 61 unique line segments, one for each point to its nearest road. Instead I ...
3
votes
1answer
285 views

Calculating nearest neighbor within each polygon using QGIS?

I have 3 layers: world map divided into countries; layer of points representing cities; layer of points representing conflict events (e.g. firefight). My goal: For each city, calculate the nearest ...
3
votes
2answers
127 views

Calculating distance between multiple lines of points in QGIS?

I'm looking to calculate a distance from a sensor reading to that of the nearest sensor reading on a different sensor line, all held within the same points file. Ideally using QGIS. The image below ...
3
votes
2answers
1k views

How to UPDATE with LATERAL Nearest-Neighbour query?

Say I have table gps like: CREATE TABLE gps( gps_id serial primary key, measured_timestamp timestamp, geom Geometry(Point,4326), stop_id int --Null ); And I have a table of stops like: ...
0
votes
0answers
33 views

NearestNeighbor producing bad quality tiles

I have been using Bicubic interpolation to render some basemaps because this produced good results. This is what I get when using Bicubic: However, when using Nearest Neighbor interpolation, a white ...
0
votes
0answers
34 views

Finding nearest 10 observations that occurred 2 years before original observation using ArcGIS Pro ModelBuilder?

I have a point sample of house sales (~42k points over 9 year period) with a date field(integer), and for each point I want to find the 10 nearest houses within a year of sale and also which were sold ...
1
vote
1answer
47 views

How to get Memory layer dispalyed in Vector Panel List using Pyqgis?

I have two point layer in my Project Centroid.shp and Nodes.shp.I have used Distance Matrix to find nearest Nodes point from Centroid Point. I have saved the output in FinalDistance.csv. The ...
2
votes
1answer
58 views

Neighborhood Analysis with ArcGIS Spatial Analyst to Calculate Percentage

I have a raster file where the cells (1 meter) are classified as 1 (forest) and 0 (non-forest). I would like to create another raster (1 meter) where each cell is given the percentage of cells within ...
4
votes
2answers
1k views

Combining st_join with st_nn to include all points within, as well as within a given distance of a polygon

This is a follow up to my earlier question (Spatial join in R - Adding points to polygons with multiple corresponding points). I have successfully joined a spatial points file to a polygon file in R ...
3
votes
1answer
343 views

PostGIS -> LineString + PointZ = LineStringZ

DATA I have 2 tables in PostGIS: linestable with MultiLineString geom surveypointtable with Point + elevation attribute GOAL The goal is to rebuild the lines as 3D replacing line's vertices with ...
2
votes
1answer
460 views

Matching two point clouds without loss (nearest neighbor, but more complicated) [closed]

I have two point clouds, one with demographic and one with electoral data. Points in both clouds represent the same empirical entity (say, a village, or an urban neighbourhood), but are not in the ...
18
votes
1answer
8k views

Finding Nearest Line Segments to Point using shapely?

Background From a known Point, I require to establish the nearest surrounding "visible perimeter" against a table of MultiLineStrings, as shown on the diagram. I've searched this site with a number ...
1
vote
1answer
197 views

KeyError: u'M' in Average Nearest Neighbour test

When I try and run the Average Nearest Neighbour test on my Shapefile I get the error: KeyError: u'M' Failed to Execute (AverageNearestNeighbour) On a "normal" Shapefile this works fine. However I'm ...
4
votes
1answer
192 views

Spatial Analysis - Identifying Regions with Common Boundaries

I have the shape file for DC PSA's as defined in 2012 (see below). I would like to be able to identify in semi-automatic fashion which PSA's are neighbors - that is, which PSA's are nearest neighbors ...
0
votes
1answer
338 views

Find the closest Point from a Point which contains the same attribute

I am trying to create python code to iterate through points on 1 layer and find the closest point on another layer (Road Chainages) based on attribute values. I need to limit the search to < 20m ...
0
votes
0answers
53 views

PostGIS - Nearest Neighbour Join to sum values

I have a table of polygons T1 and a second table of points P1 Each point has a value I want to sum the values of P1 for each T1, with P1 being the closest set of points to T1 At the moment the only ...
3
votes
1answer
653 views

Classifying raster that takes neighbours into account?

I am working on classifying forest types using Sentinel-2 satellite imagery (10-m resolution; band-2, band-3, band-4 & band-8). I have ground-truthed field data as a training set. I want to set a ...
0
votes
1answer
772 views

Spatial join attributes based on closest point in PostGIS

I have two point tables from which I want to extract a value from one table to the other, based on the nearest distance of those two points. t1 t2 id | value id 1 | 100 1 ...
2
votes
2answers
200 views

Classifying neighbors AND neighbors of neighbors using ArcGIS Desktop?

In ArcGIS 10.2, I'm trying to identify the neighbors AND neighbors of neighbors for counties in the United States. Although I can identify which counties are neighbors to each county using either a ...
2
votes
1answer
76 views

How to find the closest stop point PostGIS

I have Point geometries created from lat,lon I loaded all the 10,000 stops in a certain city using gtfs i would like to query my db to find the closest stop reference to my point. the staypoint ...
1
vote
0answers
108 views

Applying Edge Correction in ArcGIS Average Nearest Neighbor?

I am using ArcGIS 10.3 with the tool Average Nearest Neighbor from the Spatial Statistics toolbox to describe the data. I want to avoid mistakes caused by Edge Effect. In the Ripleys K Function tool ...