Questions tagged [spatstat]

spatstat is a package for the statistical software suite R to conduct spatial point pattern analysis and modeling

Filter by
Sorted by
Tagged with
0 votes
1 answer
41 views

Rasterise a point pattern in R

I have a set of georeferenced points within an area for which I want to know the spatial distribution (sparse/clustered) according to a regular grid. I thought to describe the pattern using the Clark-...
user avatar
  • 143
0 votes
0 answers
13 views

Using maptools to convert from categorical raster to im

My situation is the same as at R package spatstat: How to use point process model covariate as factor when pixel image values are numeric But as geostatsp is archived, I'm using maptools to attempt to ...
user avatar
  • 1
0 votes
0 answers
41 views

ks.test in spatstat package

I'm trying to make ks.test on my data in spatstat package. I use ppp function to create my pattern named ppp then when i try this code: ks.test(ppp,"x") as in the documentation it says ...
user avatar
1 vote
0 answers
23 views

Accounting for minimum distance between points when conducting point pattern analyses in spatstat

I've noticed an issue when performing exploratory analyses of my point pattern. When plotting a G function in spatstat, I've noticed G values remain near zero up to an r of around 5 micron [see below ...
user avatar
1 vote
1 answer
25 views

Tessellation will not display quadrat totals when plotted (spatstat, R)

I have tessellated an image, and am trying to plot the number of quadrats that appear in each tessellated region. I have two problems here: My tessellated image will not plot with my gw_ppp points, ...
user avatar
1 vote
1 answer
148 views

Creating a point pattern (ppp) error using SpatStat in R: "Only projected coordinates may be converted to spatstat class objects"

I have a point dataset, and I am taked with filtering out duplicate coordinates, removing all points that are outside of a specified county shapefile, and then creating a ppp points object. However, ...
user avatar
0 votes
1 answer
56 views

Extract a network from spatstat to graph object in igraph using R

I am looking for an efficient way to transfer a linear network (class linnet) from spatstat, e. g. library(spatstat); data('chicago'); net <- spatstat.linnet::domain.lpp(chicago) to a 'graph' ...
user avatar
  • 113
0 votes
1 answer
156 views

Plot points in spastat ppp object

I am new to spatstat package and I am trying to make a point patten map with a shape file and some case points. I was able to plot the shape file plot but I just don't know how to make the points on ...
user avatar
2 votes
1 answer
120 views

Calculating the cross-nearest-neighbor distance in spatstat

I wish to calculate the cross-nearest-neighbor distance between two point patterns in spatstat. According to Pr. Sadahiro, the cross-nearest-neighbor distance is defined as: My inputs are sf datasets,...
user avatar
  • 387
0 votes
0 answers
174 views

How do you convert SpatialPoints object to PPP object?

I have a shapefile layer of polygons (houses in a city) that I want to run a kernel density on using the density() function in spatstat in R. To get my polygons as points I turned them into ...
user avatar
1 vote
0 answers
39 views

R statspat package (or similar pkg) and convert back to spatial objects

I've been testing the waters and doing some basic overview on the statspat package. This is a complex package and would likely require some serious effort to jump in and then get familiar with the ...
user avatar
  • 141
1 vote
1 answer
242 views

Shapefile vector point to ppp spatstat with polygon windows

I always get error to this when converting shapefile point to ppp spatstat that windowed by a polygon shapefile # polygon that to be window neighborhoods <- st_read("neighborhoods/...
user avatar
  • 165
0 votes
1 answer
73 views

Estimating spatial autocorrelation from counts on linear network [closed]

I'm working with count data sampled along roadways. I would like to estimate the spatial autocorrelation of the counts, but I'm having trouble wrapping my head around how to incorporate the network ...
user avatar
0 votes
0 answers
39 views

Superpixel segmented image boundary into SpatialPolygons format

I have an image mask segmented through superpixels algorithm like this. I want to just extract its boundary and save it as a shapefile SpatialPolygons for using spatstat. Can anyone help on how to go ...
user avatar
  • 101
1 vote
1 answer
68 views

Error in converting shapefiles into spatstat window

I wish to import shapefiles of the Seoul Capital Area to use as a window in spatstat. The SCA is the combination of the Seoul, Incheon, and Gyeonggi-do level-1 administrative areas of South Korea. I ...
user avatar
  • 387
1 vote
0 answers
25 views

How much W shape effects on the cross correlation of points in R

I am analyzing cross-correlation between these two-point data sets (all the analyses have been performed in R: by using Kcross, Lcross functions). In the first trial, I was using an irregular ...
user avatar
  • 19
0 votes
0 answers
67 views

The confidence level alfa value for spatial randomness with Ripley K and L function

I have a point set of the spatial distribution of twitter posts relevant to a certain event. I would like to evaluate evidence for clustering or dispersion of points. This is usually performed by ...
user avatar
  • 19
1 vote
0 answers
37 views

Replicated Point Pattern: Get Density Variance Between Replicated Patterns and Subtract from Composite

I have written a lengthy code that dissects differently shaped/sized windows into recognizable components (individual cells in the image), gets the point density within each cell, then builds a whole ...
user avatar
2 votes
1 answer
910 views

calculate distance of points from centroid

I have a spatialpoints object, and a spatialpolygonsdataframe, composed of rectangular cells, and which the spatialpoints fall into. What I would like is to determine which polygon in the ...
user avatar
1 vote
1 answer
21 views

DSpat::create.lines and spatstat::rlinegrid: Adding too many lines?

Does anybody know of an issue with either DSpat's create.lines or spatstat's rlinegrid? Whenever I use these functions on my Windows (owins), the output has far too many lines. For example, if I run ...
user avatar
1 vote
1 answer
174 views

Connecting spatiallines or SpatialPoints based on minimum distance using R

Does anybody know of a way to create a single polygon (that will eventually be converted to an Owin) from either a spatialpoints object or a spatiallines object? Here is an example of each: Here's ...
user avatar
2 votes
1 answer
70 views

Aligning Multiple Polygons (Based on centroid possibly) [Spatstat, sf, sp]

I'm trying to create a composite/average of multiple similarly shaped polygons. I think the first step is most likely to align them via the centroid of each polygon. Does anybody know of a tool to ...
user avatar
2 votes
2 answers
1k views

QGIS enabling R via plugin

System Ubuntu 19.10, QGIS 3.4 I am trying to utilise R in QGIS for Ripley's K function. The sample R script 'Scatterplot' works with the Processing R Provider plugin, which indicates r-base is ...
user avatar
  • 53
1 vote
1 answer
179 views

Generating pattern in each of set of polygons using sp (r)?

I have an object of class SpatialPolygonsDataFrame, and for each polygon in the dataframe I have a number of points I would like to generate in that polygon (e.g. I have 130 polygons, and I have a ...
user avatar
3 votes
2 answers
1k views

R (spatstat, sp, sf): Grid a single polygon, divide, alphanumeric labels based on column/row

I am trying to take a polygon and add grid lines over top, then divide the polygon into many polygons based on the grids. I've accomplished this through st_make_grid() and raster::intersect(). The ...
user avatar
1 vote
0 answers
91 views

Multiple Spatial Point Patterns, create "average" heatmap

I am using R's spatstat package to analyze spatial patterns of objects across plant leaves. Let's say I have 10 leaves, each with corresponding X,Y coordinates of the objects and a window in the ...
user avatar
1 vote
1 answer
78 views

Point.in.polygon function in sf package miscalculate the distribution of points

I am using point.in.polygon function in sf package to determine whether a set of data fall within a polygon or not. Here is a snippet of the data and polygon visualization As the figure shows, there ...
user avatar
1 vote
1 answer
139 views

Convert ppp object to multitpe object

I am working on spatial point pattern analysis using R. I have two sets of coordinates, both defined inside a 32*20 region. I first convert two data sets to ppp objects: Tumor_CD8 <- ppp(...
user avatar
3 votes
0 answers
146 views

Test the relationship between two point patterns

I have two point patterns obtained from medical images. Points are used to represent cell markers. By visualization, the point pattern A is extremely possible to be a subset of point pattern B. So is ...
user avatar
  • 31
0 votes
0 answers
181 views

Generating Pseudo-Absences in spatialEco?

I want to generate pseudo absences based on kernel density estimate from a linear feature spatial line layer, where pseudo absences have a higher probability of being sampled near a line. I have ...
user avatar
  • 23
1 vote
1 answer
212 views

Adjusting resolution of spatstat::pixellate.psp() output

I am trying to accomplish exactly what is being done in this question: Convert line shapefile to raster, value=total length of lines within cell using spatstat::pixellate.psp() technique (see third ...
user avatar
  • 1,141
1 vote
1 answer
329 views

Kernel Density Map points rejected as outside window

I am trying to make a kernel density plot of a points shapefile like so: library(rgdal) library(spatstat) library(maptools) points <- readOGR(dsn = "C:\\Documents", layer = "...
user avatar
2 votes
0 answers
75 views

One-dimensional data in spatstat

I have data of one-dimensional points (locations in a straight line). I want to check if the cluster poisson process models or Cox models are a good fit for the data. Since my data only has x-...
user avatar
0 votes
1 answer
422 views

How to have a Raster output of a ppm model in spastat

I am trying to compare the outputs of species distribution models. My current code uses the following function to calculate TSS scores. TSS_Score<-function(TrueBinary, Raster) { Raster[]<-as....
user avatar
  • 23
1 vote
2 answers
99 views

Error in pairdist calculation

I'm trying to calculate pair distances among the points of my dataset. I have point in EPSG:3857. This is the code I ran: I import the data, then: coordinates(datPb) <- c("X","Y") proj4string(...
user avatar
3 votes
1 answer
2k views

Removing frame/plot borders from plot.im output

I am plotting point density using the plot.im command in spatstat, and my output always has a frame around the plotted image that becomes thicker when I increase resolution for export. I tried frame=F,...
user avatar
  • 31
1 vote
1 answer
1k views

Creating polygonal windows for spatial analysis in r

I am attempting to normalize a spatial point pattern using a population density raster in r. My problem is that the function I am trying to run is recognizing the "white space" around the raster I am ...
user avatar
14 votes
1 answer
4k views

Calculating road density in R using kernel density? [closed]

I have a large (~70MB) shapefile of roads and want to convert this to a raster with road density in each cell. My initial approach was to directly calculate the lengths of line segments in each cell ...
user avatar
  • 1,761
0 votes
1 answer
538 views

Adding 'marks' to point file in spatstat?

Using help on this site I have already got the following code from where I can perform certain analyses. However, I'd now like to perform analyses on a certain variable (column z) within the point ...
user avatar
3 votes
1 answer
863 views

Adding point shapefile layer to polygon shapefile window in R?

I'm new to Spatstat for R and I'm trying to add a point layer to a window I've created from a polygon. I see questions like this have been asked before but I still can't get what I need from the ...
user avatar
1 vote
2 answers
1k views

R package spatstat: How to use point process model covariate as factor when pixel image values are numeric

I am trying to model a point process with an image covariate using the ppm() function in the spatstat package in R. I convert my raster to an im object for use with spatstat, and I run into a problem ...
user avatar
1 vote
3 answers
4k views

Converting raster to im object for point process model covariate in R?

I am trying to convert a raster object to an .im object for use with a point process model in the spatstat package in R. I begin by creating the raster from a tiff file using the raster() package. No ...
user avatar
1 vote
1 answer
2k views

How to find highest kernel density point

I've been using spatstat to analyse point patterns in R. Here's an example to put this in context: library(spatstat) library(maptools) # to convert sp class to ppp Some point data: set.seed(1985) x ...
user avatar
0 votes
1 answer
3k views

How can I connect my point pattern shapefile with my polygon window in R?

I would like to do some spatial statistics in R. I have a point layer called '1983' that represents the distribution of one species, and a polygon layer called 'SA-R' that represents the study area. ...
user avatar
  • 165
3 votes
1 answer
1k views

Python equivalent of spatstat's spatial point process functions

Is there a free Python package (i.e. PySAL?) that implements the standard summary statistics for spatial point processes, e.g. the F, G, J, and K functions? I'm happy to use R (i.e. spatstat) if that'...
user avatar
2 votes
1 answer
2k views

R - Crop a pixel image produced by spatstat with a boundary shape

i am using the very good spatial statistic package spatstat to produce probability maps of spatial point patterns. Here is a simple working result from the examples to try out. require(spatstat) ...
user avatar
  • 7,928
12 votes
3 answers
8k views

How to get the second nearest neighbor between two point patterns in R?

Is there a way to get the distances for the second nearest neighbor between two point patterns in R? The spatstat package has a function called nncross but it only applies to the nearest neighbors ...
user avatar
  • 17.2k
22 votes
3 answers
5k views

Using R with ArcGIS Desktop?

I've used the integration of R with QGIS, and found it a very uesful tool. Having taken a look at the R toolbox extension for 9 and the extension for 10 it appears they both offer only point ...
user avatar
  • 15.3k