I have a shapefile and a raster file which I want to merge. Normally I would Extract by mask the rasterfile to obtain delineation of the shapefile. But now the shapefile has sub-delineation inside which I want to keep. One way to do this is Polygon to raster where I choose the raster-file inside cell size. However when I do this the right uppper coordiante is off the chart with values of 10^4 for a WGS 1984 decimal degree georeference. The projection of the two files do not seem to make any difference.
ArcGis 10.1
Related
I am trying to extract information on the % of different vegetation cover types within areas that have not been burned. However, the data I was given for the park includes areas that have been burned as a raster file in NAD_83 projection, and the vegetation cover as a polygon layer in WGS_84 projection. Essentially, I'm trying to erase the overlap between areas that have been burned and the vegetation layer to only look at vegetation cover types in areas that have not been burned. The vegetation is broken into 12 class labels based on understory/shrub cover type, and I want a percentage of how much each cover type occurs in unburned area. Can anyone help with this transformation?
I have access to ArcGIS Desktop v 10.8.2 with an Advanced licence.
I have tried converting the raster to points which worked, but I don't know how to make the points into polygons that perfectly match the size/shape of the original raster. I don't know another way to "erase" the two layers other than by trying to convert the raster to a polygon with the same coordinate system.
ArcMap is probably reprojecting the data on the fly, but you could start by transforming the raster and vector layers to a common datum.
If I understand correct, you want to know the area of veg types represented as polygons that are within unburned areas which are represented as pixels in a raster.
If that is correct, I would convert the unburned areas to a polygon layer. It might help to convert the burn raster such that unburned = 1 all else = 0 or NA, then convert unburned to a polygon.
With the unburned areas represented as polygons, intersect this layer with the veg layer. Doing so will cut the veg layer by the unburn polygon layer. The result should allow you to only select polygons that intersected with the unburned layer once it is vectorized. Get the area of these polygons grouped by veg type.
I have a raster file with two bands and a vector shapefile. I used raster extraction by mask and created the desired area. Now I want to calculate the number of pixels for Band 1 and Band 2 of the new clipped mask file. What would be the best way to do that?
I have a bunch of (x,y) coordinates that I obtained by thresholding a 3D plot. When I plot the coordinates I get this surface:
These points are densely packed (the area in the middle is not colour fill, it's all points) and have an irregular shape. How do I obtain the boundary of this surface?
I tried saving the points as a SpatialPolygon object but that included the points in the middle. I want to only extract the boundary somehow and save that as a polygon.
Can I save these points as SpatialPoints and somehow dissolve the points in the middle?
I generate a raster map in R with some shaded portion, then i plot my shape file on the raster file to show boundaries of the map. I can calculate the the overall shaded area with a code but I want to calculate the shaded region coming under the separate polygons when i plot shape file on raster. Please help me with the code.
I am using maxent in R to have an idea of suitable area of certain crop for whole country. when I generate map, it is a raster file and I can calculate suitable area for whole country with a code, but I want to calculate the area for provinces as well for which i plot province vise shape file on the raster map.
I want help with the area calculation for each shaded polygon when i plot shape file on raster
pred_me2 [pred_me2 <=0.33] <- NA
pred_me2 [pred_me2 >0.66] <- NA
cell_size<-area (pred_me2, na.rm=TRUE, weights=FALSE)
cell_size<-cell_size[!is.na (cell_size)]
suitable<-length (cell_size)*median(cell_size)
You can try with this:
cell_size <- xres(pred_me2)*yres(pred_me2)
area_NA<- sum(is.na(values(pred_me2))) * cell_size
area_non_NA <- sum(!is.na(values(pred_me2))) * cell_size
I would like to be able to create an elevation plot from contour lines in R. I am very new to using shape files
At the moment I have downloaded data from here
which provides .shp files for all of the UK.
It also provides the contour lines, summarising the topology of the UK.
For the elevation plot I would like a data.frame or data.table of evenly spaced points (100m apart from each other) to produce a data output giving an x, y and z value. Where x and y represent the latitude and longitude (or Eastings and Northings), and z represent the height (in meters above sea-level).
I think there are probably some tools that will automatically carry out the interpolation for you, but am unsure how it would work with geo-spatial data.
This is my basic start...
require(maptools)
xx <- readShapeSpatial("HP40_line.shp")
Choose "ASCII Grid and GML (Grid)" as download format for the "OS Terrain 50" product, and download the file. This will give you a zip file containing many directories of zip files, each of which contains portions of a 50 m elevation grid of the UK (the portion I looked at had 200 x 200 cells, meaning 10 km x 10 km). I went into the directory data/su, unzipped the zip file there, and did
library(raster)
r = raster("SU99.asc")
plot(r)
to aggregate this to a 100 m grid, I did
r100 = aggregate(r) # default is factor 2: 50 -> 100 m
As mentioned above, the advice is to work on the grids as contour lines are derived from grids, working the other way around is a painful and a great loss of information.
Getting grid values in longitude latitude as a data.frame can be done in two ways:
df = as.data.frame(projectRaster(r, crs = CRS("+proj=longlat")), xy = TRUE)
unprojects the grid to a new grid in longitude / latitude. As these grids cannot coincide, it minimally moves points (see ?projectRaster).
The second option is to convert the grid to points, and unproject these to longitude latitude, by
df2 = as.data.frame(spTransform(as(r, "SpatialPointsDataFrame"), CRS("+proj=longlat")))
This does not move points, and as a consequence does not result in a grid.