21
votes
Clustering spatial data in R?
Here is a solution based on Find clusters of points based distance rule, but using the distm function from the geosphere package:
library(sp)
library(rgdal)
library(geosphere)
# example data from ...
20
votes
Joining polygons in R
Here is a solution using the sf package:
library(tidycensus)
library(dplyr)
library(sf)
library(ggplot2)
# get data from tindycensus for demonstration (note you need an API key, folow instructions ...
20
votes
Statistical tests for spatial line patterns?
This is a difficult question as there just have not been many, if any, spatial process statistics developed for line features. Without seriously digging into equations and code, point process ...
14
votes
Statistical tests for spatial line patterns?
You might want to look into Fréchet distance. I only recently found out about this after a recent question looking for a python implementation.
This is a metric for finding spatial similarity of ...
10
votes
Accepted
Calculating field AVG from B layer 3 nearest points to each A layer point
Sorry, I can not provide an answer for QGIS 3.4, but for 3.8+, in case you have a chance to update. The tool you need for this is called join attributes by nearest, which was introduced with 3.8. For ...
9
votes
Accepted
Getis-Ord Gi* (arcgis 'hotspot analysis') with python?
Check out PySAL: The Python Spatial Analysis Library
https://pysal.readthedocs.io/en/latest/
8
votes
Accepted
Dividing Polygon into parts which have equal area using R
As I needed something similar, I wrote a small function for R following the steps of this question on "Splitting polygon into equal area polygons using QGIS"
I hope this helps somebody, even ...
8
votes
Accepted
Calculating statistics of points within polygons of the same criterion in QGIS
Great question. Welcome to the weird and wonderful world of the aggregate() function. It's very powerful but tricky to learn, I've used it a lot and still have to read the documentation carefully most ...
7
votes
Polygon Shape Similarity using PostGIS?
Have a look at the PostGIS function - ST_HausdorffDistance
http://postgis.net/docs/ST_HausdorffDistance.html
This is a measure of how similar or dissimilar two shapes are.
7
votes
Distance between GPS travel route and country border
You can do this using QGIS and OpenStreetMap data, so OpenSource/Open data and free to use. The process includes several steps. Using the online QGIS documentation can help you for the steps. When you ...
6
votes
Geometry type issue with st_intersection() between polylines and polygons
The ST_Intersection can produce different geometry-types in one go (image two lines intersecting at one point, returning a point) and likely therefore you are receiving linestrings and ...
6
votes
Accepted
Optimally thin or subset sample points
There is a function pp.subsample in the spatialEco package that will subset your data using a spatial intensity function. This will, in effect, thin your data to a defined n, using the expected ...
6
votes
Computing annual spatial (zonal) statistics of a NetCDF file for polygons in shape-file
I used this code to get want I wanted:
# import packages
import xarray as xr
import rasterio as rio
import geopandas as gpd
import rasterstats as rstats
# load and read shp-file with geopandas
...
6
votes
Calculating buffer distance for different groups of parallel lines in QGIS
What you want to achieve is basically a kind of "clustering" of lines: grouping lines that are close together. You need one manual decision, a maximum distance up until which lines should be ...
6
votes
Accepted
Interpolation with 10 data points
Both methods are "appropriate".
IDW basically says "half way between a point valued 6 and a point valued 8 the value is going to be 7", but extended to the distance to multiple ...
6
votes
Accepted
Computing grid cell statistics using LiDAR point cloud in QGIS
With QGIS 3.32 (see the changelog) you have some native algorithm in the Processing Toolbox (Ctrl+Alt+T), there you can export the point cloud into a raster format, DEM for example and make statistics ...
5
votes
Accepted
Spatial outliers detection in R?
We can run through some straight-forward approaches starting with looking at the modified z-score on the variable of interest (a-spatial) then move to calculating the local z-score and variance within ...
5
votes
Statistical tests for spatial line patterns?
I am suggesting to use approach similar to one explained here.
ALGORITHM and naming:
a) Name line layer NODES. Compute bearings
b) spatially join to itself (one to many) using distance tolerance. ...
5
votes
Statistical tests for spatial line patterns?
There is in my eyes a problem with the definition of the lines, one that will determine what approaches to use ( some of those mentioned above). If these are OD pairs, and the geometry does not play a ...
5
votes
Access to attribute in rasterlayer in R
You can access this table via levels:
> levels(r)
[[1]]
ID OID Value Count LC_Code Land_Cover Area_Ha
1 0 0 0 25615512 255 No Data 2305400.00
2 1 1 ...
5
votes
Choosing spatial statistical tool in ArcGIS Desktop?
Spatial Statistics Resources or https://spatialstats.github.io/. This page made in 2010 in the esri blog,But esri update it when a new resource availabled.
The ESRI Guide to GIS Analysis, Volume 2. ...
5
votes
Accepted
Calculating Moran's I on large point dataframe in R
I had this same problem. I created an R package that calculates the distance matrix on the fly, so it takes much less memory to calculate Moran's I. Its also quite fast. You can find it at github....
5
votes
Accepted
How to obtain elevation differences between point and raster cell in R
Outline solution:
Install the FNN package from CRAN.
Use nni = FNN::knnx.index(coordinates(s), coordinates(r), k=1) to get the index in s of the nearest neighbour for each cell coordinate to the ...
5
votes
Do I necessarily need coordinates for spatial prediction?
The spatial prediction aims at predicting a variable where it has not been observed. Therefore you need to know the coordinates of the location where you make the prediction, even if the coordinates ...
5
votes
Distance between GPS travel route and country border
With QGIS you can use the following processing tools:
GPS route as input:
Densify by interval (add vertices every 1 m)
Extract vertices (create a point layer from the vertices)
With country border ...
5
votes
Determining who and why certain data was mapped in OpenStreetMap
OSM is a collaborative geographic database, fed by the goodwill of volunteer contributors. Therefore there are no real input specifications (as there might be in a reference database), just guidlines, ...
4
votes
Interpreting semivariogram with high nugget effect?
I am wondering if someone can explain why the nugget seems so high? Does this mean that even at similar locations, there is still a relatively high degree of difference?
Yes, a high nugget effect (...
4
votes
Which statistical methods to compare the spatial distribution of two different variables in two raster maps?
tl;dr: pick a segregation measure from the seg package, probably the isp() function as an implementation of White (1983).
I'd recommend using an entropy segregation measure. Probably you need some ...
4
votes
Accepted
Gstat krige() error: Covariance matrix singular at location [917300,3.6109e+06,0]: skipping
This is caused by the matrix library used by gstat. Historically (gstat was released as open source code in 1997) it used the LDLfactor routine in the meschach library. Around 6 months ago I factored ...
4
votes
Exponential function variogram sill values
Yes, this is correct. When you print the model by typing
model.vari
you'll see sill values, split up in a nugget component (the offset) and the exponential component. The sum of these two is usually ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
spatial-statistics × 671arcgis-desktop × 181
r × 181
qgis × 85
raster × 72
spatial-analyst × 60
autocorrelation × 54
interpolation × 42
statistics × 40
arcmap × 35
python × 29
arcgis-10.0 × 27
clustering × 26
regression × 26
polygon × 23
kriging × 23
arcgis-10.2 × 21
point × 21
arcgis-10.3 × 21
moran-index × 18
postgis × 16
coordinate-system × 16
shapefile × 14
arcgis-10.1 × 14
zonal-statistics × 14