# Tagged Questions

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.

51 views

### PostGIS Nearest Neighbour outside buffer

I am trying to find the 6 nearest neighbours to a point which are outside a defined buffer. Basically I am comparing points of the same table and working with Mike Gleason's examples. WITH subq AS ...
22 views

### QGIS nearest neighbor parameter description

Could anyone explain me the following parameters, which I get by doing a nearest neighbor statistic on a point shape? I suppose that Observed mean distance is the mean distance between two points ...
64 views

### QGIS - Calculate distance between a point layer to n nearest polylines

In QGIS I am trying to calculate the distance from a point layer to a polyline layer for the n nearest polylines. I have figured out how to calculate this distance to the centroid of the polylines ...
87 views

### N Nearest Neighbours efficiently PostGIS/Python

The data is worldwide about a million points, lat/lons, with an id and an importance value (0.0 to 1.0), and it's limited to being on land. Ideally I need to cluster all 1 million points into 100,000 ...
33 views

### Weighting Point Data whilst performing a Near analysis

I am struggling to work out how I can assign weights to my points (airports), So far I have carried out a Near fuction so that all of my raster (output areas ) are assigned a point with its distance ...
40 views

### Remove points within x distance

I have these spatial points: long <- c(-1.769717, -1.767766, -1.769170, -1.768462, -1.768389) lat <- c(54.92214, 54.92207, 54.92113, 54.92167, 54.92165) points <- data.frame(long, lat) ...
137 views

### Finding closest Intersection between line strings (PostGIS)

I want to find the distance between one point (excavation sites) and a line (rivers) for the cardinal directions. What I thought would be the easiest way is to draw lines between the excavation site ...
394 views

### Improve speed of PostGIS “nearest neighbor” query?

One of the features of the Python/Django/PostgreSQL web application I'm building is that a user will be able to see the 100 other users who are nearest to them, sorted by distance. I'm using PostGIS ...
181 views

### How to speed up a query for nearest linestring to point data

I have processed a Strahler stream order layer with a lot of river linestrings (type: Multilinestring) and their corresponding strahler number (see information here). Besides I have a point layer. I ...
287 views

### Calculating spatial lags per year in R

At the moment I am having some difficulties with calculating a spatial lag in R. I know how to calculate the lag in space-wide format but am unable to do it in long form, i.e. have repeated ...
82 views

### Matching two point clouds without loss (nearest neighbor, but more complicated)

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 ...
436 views

### How to find nearest city using Geonames features codes

I've got about 300,000 lat/lng coordinates of events that I'm combining into a large map. The coordinates come from all over the world. For each point, I want to find the nearest city of at least XYZ ...
99 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: ...
68 views

### Use selected value in postgis function

How can I use the selected value from a SELECT statement in a PostGIS function. e.g. using the geom_way from SELECT geom_way FROM osm_2po_4pgr ORDER BY ST_Distance(ST_GeomFromText('POINT(21.323329 ...
862 views

### Find Nearest Line Segments to Point

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 ...
78 views

### How to find closest point without crossing obstacles?

I have a set of points and I'd like to be able to find the nearest point from another layer. The problem is that I need to find the closest point without crossing an obstacle (such as a river, ...
165 views

### Efficiently check for equal adjacent values in raster calculator

I have a raster consisting of integer values in each cell. I want to check every adjacent cell in a 3x3 grid to see if any one of the adjacent cells has a value EQUAL to the center cell, and if so, ...
291 views

### How to calculate the distance to multiple locations from each cell of my raster?

I'm working with Arcgis 10.1 and Python 2.7.2 How can I calculate the distance to multiple locations from each cell of my raster? I tried euclidean distance but it only provides the distance to ...
278 views

### Loop though records in PostGIS (using PL/PYTHON or PGSQL)

I've seen many example of loops, but I can't get that one to work. I work for a regional transit agency and each year, we conduct several surveys. I geocode everything to the house level for internal ...
218 views

### 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 ...
346 views

### Find nearest neighbours faster in PostGIS

I currently have a query that calculates the number of useful amenities within a certain radius of each town, using OSM data: create table places as select town.name, place, town.way, ( select ...
100 views

### Near analysis by matching attribute in two different layers

I need to perform a near analysis to assign cases in one feature class to their nearest match on an attribute in a different feature class (ex: Tutors and Tutees need to be paired by same language ...
418 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 ...
492 views

### How to determine average distance from points to line?

I have a polyline road dataset and a study area (polygon) covering the the road dataset. I want to determine the average distance for every given point within the study area to the nearest road. i ...
265 views

### Nearest Neighbor Focal Statistics and Map Algebra

I would like to use a nearest-neighbor type analysis to iterate over a raster. The nearest neighbor analysis will give a cell value of 1 IF AND ONLY IF the cell being analyzed has a cell value larger ...
440 views

### Accurate and fast nearest neighbour, which distance function should I use and how to it speed up? [duplicate]

I am solving the following problem: I have a map with many points in it and I need to find the nearest point to given location. Each point carries information about it's latitude and longitude. This ...
260 views

### Can Nearest Neighbor Analysis help determine values for a Heat Map?

Given the below parameters (from Nearest Neighbor Analysis): A) Is there a definite range my Radius value should be within? B) Are there definite values my cell size should be near? C) Is there a ...
457 views

### Openstreetmap - retrieve nearby big cities for a given location

I was wondering how I can retrieve places near a given location? For example, if I pass the osm API the location "Paris" is it possible to retrieve all the main biggest cities around Paris within a ...
240 views

### How to return nearest point to input lat/long with distance?

I am trying to write a query with PostGIS that returns one row where the geometry of that row is the closest to an input point. I would also like to include the distance between these points in the ...
300 views

### Function that applies another function to nearest neighbors of a specified location?

I'm sure this is quite basic, but I just couldn't find anything appropriate: I am looking for a function that applies another function to variables of a SpatialPointsDataFrame, but only for locations ...
154 views

### Which SRS to use for global distance queries?

I have a database with a lot of points in WGS84. Now I am building an cache that performs NN and points in range queries using a KDtree. The point [sic] is that the search radius will be provided in ...
412 views

### Stats on individual grid points nearest neighbours

First, thank you for this extremely useful and easy-to-access forum! I have shp of points where each point is the centroid of the individual cells of a 1*1km grid (~ 500 000 points). For each of ...
1k views

### Calculate polygon field based on neigboring polygon attribute

I have a vector shape with many different sized polygons each possessing an own class name (for instance "houses", "houses with offices", etc ...) I want to assign a new field to each polygon ...
812 views

### Finding nearest point in SpatiaLite without GEOS

I want to find the nearest point having latitude and longitude stored as Point in SpatiaLite. I read this and it has this example: SELECT feature_name, feature_class, ST_Distance(Geometry, ...
1k views

### Calculate Distance between a Polygon and a Point Along a Path

I am very new to ArcGis and am trying to figure out how to do this. Basically, this is what I am trying to do: I have a map of Canada and in it I have polygons representing areas (each about the ...
247 views

### Estimating cline width at multiple points along a trait gradient

In the map below I have 66 (green) points along the midpoint (0.5) for an allele frequency cline across the region (see map). I created the points by placing a point every 25 km along the 0.5 allele ...
1k views

### Nearest Neighbor problem in Postgis 2.0 using GIST Index (<-> function)

I'm trying to use Postgis 2.0 new function <-> (Geometry Distance Centroid) in order to calculate, for each row of my table (cosn1), the distance to the nearest polygon of the same class. I was ...
192 views

### Generate Near Table and keep all attributes

I am trying to calculate the angle and distance of points to surrounding polygons. The table is good and what I need but it doesn't maintain all records; the unique point and polygon IDs are not ...
2k views

### How does Nearest Neighbor Image Resampling work in ArcGIS?

I am trying to understand how nearest neighbor for the resampling of Image datasets works in ArcGIS. The output raster cell value is the value of the closest cell value in the input raster: In this ...
444 views

### How to efficiently find the closest point over the dateline?

I have a PostgreSQL 9.1 table with hundreds of thousands of PostGIS POINTs. For each of these I'd like to find the closest point in another table of POINTs. The points in the second table represent a ...
3k views

### How to find nearest neighbors between two tables with point locations in SpatiaLite?

I have started playing with SpatiaLite today and already stumbled upon a problem. For each point location stored in tableOne I would like to select one, nearest (linear distance) point from tableTwo. ...
2k views

### optimize nearest neighbor query on 70 million extremely high density spatial point cloud on SQL Server 2008

I have about 75 million records in a SQL Server 2008 R2 Express database. Each is a lat long corresponding to some value. The table has geography column. I am trying to find one nearest neighbor for a ...
2k views

### Optimizing a nearest neighbor calculation using PostGIS

I'm using PostGIS to calculate the nearest neighbors of polygons. What I want to calculate is the minimum distance from each polygon, to the nearest polygon. Thus far I have got great help from Mike ...
1k views

### Nearest Neighbor calculation in PostGIS

I'm learning how to use PostGIS and spatial databases for analysis. What I am trying to do is perform a calculation to get the distance for the nearest polygon in a file, using the edge calculation, ...
5k 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?? ...
554 views

### (Smooth) Isoline Extraction from TIN - Algorithms

Can anyone point me to a clear document or algorithm for extracting smooth isolines from a Triangular Irregular Network? I've seen some examples using the jagged linear methods, but can't seem to ...
4k views

### Algorithm to find nearest point

I've a list of a few hundred cities with their latitude/longitude. Given another location (also in lat/long) I need to find the nearest city. As I don't use any GIS, by now the obvious algorithm is ...