Spatial Allacator Projection Error

Hello,

I am running through the directions for BELD4 Land Cover Generation.
https://github.com/CMASCenter/Spatial-Allocator/blob/master/docs/User_Manual/SA_ch04_raster.md#beld4

I keep getting this error when running Spatial Allocator.

Compute percentage of imperviousness or canopy in domain grid cells…
/home/pkasper/Documents/Spatial_Allocator/data/NLCD2006/Cartographic/nlcd2011_usfs_conus_canopy_cartographic.img
Image size is 161190x104424x1
Image UL Origin = (-2493045.000000,3310005.000000)
Image Pixel Size = (30.000,30.000)
Image extent: minXY(-2493045.000,177285.000) maxXY(2342655.000,3310005.000)
Error: This image’s projection is different from the domain grid image’s.
Projection for this image = +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
Project it using gdalwarp utility to: +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

There is nothing in the directions in how to do reprojection. Am I doing something wrong or is there a source on how to do reprojection?

Sorry for the late response. We will get back to you ASAP.

The difference-problem is that they use different geodetic spheroids: one uses WGS84, the other uses GRS80.

As a fallback, you could use GRASS to define two “projects” with each of these spheroids, and the related other metadata, and then use GRASS to project the data from one to the other.

1 Like

Lawless,

The reason why it doesn’t work is because NLCD Urban and Land cover are in WGS84 while the Tree canopy is GRS80, which are virtually the same. The way to fix it is to determine which projection to choose. To do this you use gdalwarp. I have found you should make 3 new images all the same way, from the 3 various old images, roughly 30 minutes on my system, each. I have found just changing the 1 image that it wants results in other errors saying to use gdalwarp again to change it to a different image usually having to do with +towgs84. The following code is an example of how to set them up and run as a GRS80, obviously if you want the WGS84, replace it where GRS80 is. I just had this exact same problem with the 2016 NLCD files and this ran the BELD4 to completion.

gdalwarp -overwrite -s_srs ‘+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs’ old_tree_image.img new_tree_image.img

gdalwarp -overwrite -s_srs ‘+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs’ old_land_image.img new_land_image.img

gdalwarp -overwrite -s_srs ‘+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs’ old_urban_image.img new_urban_image.img

Insert the new names of the images into your text file and this should do it.

Thank you!

I was able to get it to work now