Unknown Map Code Error

187 views
Skip to first unread message

Robert Scheller

unread,
Oct 17, 2011, 4:33:15 PM10/17/11
to landis-...@googlegroups.com
Dear All:

My master's student found a work-around for map code errors generated from legacy (*.gis) maps. Here it is:

When presented with the 'Unknown Map Code' error, the first thing I did was open the initial communities map in ArcMap (I'm running 10) to look at the pixel values (you may have to build the attribute table). You can then compare that range of pixel values in your Initial Communities map with the range of MapCodes in your Initial Communities input file. That's how I found that somehow my Initial Communities Map had pixel values from -32,000 to 32,000 for some reason, whereas my Initial Communities input file had MapCode values ranging from 0 to ~51,000, so I had to change the map to reflect what was in the input file. The initial communities map Im using is a signed 32-bit .img file, which was converted from a signed 16-bit .gis. I did this in ArcMap 10 by: 1. Opening the .gis as a layer in ArcMap 2. Exporting the .gis layer data as a .img (right click on the layer in the Table of Contents -> Data -> Export Data) 3. Use the 'Copy Raster' Data Management Tool to convert the new .img layer into a signed 16-bit pixel type I ran into some issues because my original map code values (0 to 51,000) somehow got shifted (-32,00 to 32,000), so I had to include an extra step to realign the values. I did Step 1 (above), Step 2, 'Copy Raster' to an unsigned 16-bit.img, 'Copy Raster' to a signed 32-bit .img.

Inga

unread,
Oct 18, 2011, 9:49:46 AM10/18/11
to LANDIS-II Users
Hi All,
Just a few more tips for GRID maps derived from .gis maps after
performing reclassifications, clipping etc in ArcGIS10.

If you find that your GRIDs are listing all the values between your
mapcodes as classes with raster counts as zero (due to legacy .gis
conversions) , you can use Extract by Attribute with the SQL
calculation set to Count > 0 to reduce your classes to those with
raster counts greater than zero.

Also, I frequently got GRIDs with NoData set to some large negative
number after clipping. LANDIS-II needs input with NoData set to
zero. This needs to be done in Raster Calculator instead of
reclassify if you have thousands of mapcodes and you can use this
formula: Con( IsNull ("MyRaster"), 0,"MyRaster") with no spaces at
the end of the line. Trying to use Reclassify with 6000+ classes to
change the NoData to zero doesn't work because it tries to bin your
inputs.

Use Processing Extent in your Environment settings anytime you do any
processing on your GRIDs to make sure you are setting your extent and
snapping to whatever your base layers are.

Bogdan Chivoiu

unread,
Oct 19, 2011, 5:46:12 PM10/19/11
to LANDIS-II Users
Hi everyone,

As a result of my initial communities assignment algorithm, I get an
ASCII file. If the number of MapCodes in the ASCII file is larger than
32768, then I need to convert the ASCII file to a 32-bit integer .img
file.

My version of the procedure posted by Rob is:
- convert the initial ASCII file to an unsigned 16-bit .img (via an
ESRI grid file), using ArcINFO Arc commands (command-line)
1. ASCIIGRID asciiFile gridFile INT
2. GRIDIMAGE gridFile NONE imgFile IMAGINE
- then convert the resulted unsigned 16-bit .img to a signed 32-
bit .img with the Copy Raster tool in ArcGIS.

I hope this is useful.

Best,
Bogdan

Pui-Yu Ling

unread,
Nov 1, 2011, 3:48:07 PM11/1/11
to LANDIS-II Users
Dear all,

Thanks for the tips. I have a more basic question: Why do I need to
convert an image file to a signed 32-bit .img? I have an unsigned 8-
bit.img. (converted from a shapefile) and I converted it to signed 32-
bit .img. Actually they look the same. Moreover, the "ecoregions.gis"
file given in the "examples" folder is a unsigned 8-bit integer file
and seems to work. I am wondering why it is necessary to convert any-
bit.img file? Thanks.

Pui-Yu Ling
Reply all
Reply to author
Forward
0 new messages