1

I have a point pattern object (ppp) i.e. dataset comprising the geographic coordinates of certain positions. For example:

> data(bei)
> df1<-as.data.frame(bei)
> View(df1)
> head(df1)
      x     y
1  11.7 151.1
2 998.9 430.5
3 980.1 433.5
4 986.5 425.8
5 944.1 415.1
6 940.5 410.4

Now, I would like to fit a small bounding box of some dimension over each points in the ppp object and compute its area. How to do this using spatstat?

Or should I pixellate the ppp object? In that case, how to get the pixel area?

Lesnar
  • 501
  • 3
  • 16
  • I'm not familiar with `spatstat`, but perhaps all you want is to find a smallest rectangle containing all the points given by, e.g., `head(df1)` and its area? I'm asking because it seems like you question could be answered without knowing about `spatstat`, in which case you are much more likely to get a quick answer. – Julius Vainora Dec 16 '18 at 14:58
  • Well I don't want a rectangle to contain all the points, that can be done easily by creating a window. I want to create rectangle or boxes for each points. How to do this in R (even without using spatstat)? – Lesnar Dec 16 '18 at 15:03
  • https://www.neonscience.org/field-data-polygons-centroids – G. Cocca Dec 16 '18 at 19:25

1 Answers1

1

In the spatstat package, the function boundingbox computes the smallest rectangle that contains the spatial objects specified. In your example, you could type boundingbox(bei) to get the smallest rectangle containing all the data points in the point pattern dataset bei. The area is computed using area(boundingbox(bei)). If instead of a point pattern dataset you just had a data frame of coordinates, e.g. df <- as.data.frame(bei), then similarly boundingbox(df) and area(boundingbox(df)) give you the same information.

To search for information about spatstat you can type help(spatstat) for an overview of the available commands, or use help.search to search for keywords. Or visit the spatstat.org website.

Adrian Baddeley
  • 1,956
  • 1
  • 8
  • 7