Mathnoob Mathnoob - 1 month ago 17
R Question

Area estimation using image in R

So i'm looking for a way to estimate the area of a region, using only the image of the map. The reason i'm doing this is I want to calculate the area that would be lost upon a certain increase in sea level and I can't find any kind of meta data for that only the maps (in image formats). Here is the link to such a map:



So what i have in mind is to convert this image to a gray scale image using EBimage package and then using the pixel intensity as a criteria to count the number of pixels that represent potentially threaten area.

My question is it possible? How can we you the pixel intensity as a criteria? And if there are any other approach to solve this issue?

Also if there are way to gain access to the meta data used to plot such map that I'm not aware of please tell me.

Thank you everyone.

Edit:

Thank to hrbrmstr I was able to read the grid data int R using rgdal packages. So in order to calculate the area I tried to used the rgeos package, but the dataset from CRESIS doesn't have the shape file. So how can we define the polygon and calculate the area?
Sorry if this question seems silly. This is the first time I've ever dealt with spatial data and analysis

Answer

The data is in the ESRI files:

library(rgdal)

grid_file_1m <- new("GDALReadOnlyDataset", "/full/path/to/inund1/w001001.adf")
grid_1m <- asSGDF_GROD(grid_file_1m, output.dim=c(1000, 1000))

plot(grid_1m, bg="black")

enter image description here

grid_1m_df <- as.data.frame(grid_1m)

str(grid_1m_df)
## 'data.frame': 2081 obs. of  3 variables:
##  $ band1: int  1 1 1 1 1 1 1 1 1 1 ...
##  $ x    : num  -77.2 -76.9 -76.5 -76.1 -75.8 ...
##  $ y    : num  83.1 83.1 83.1 83.1 83.1 ...