Subscribe to this thread
Home - General / All posts - M9 import 8-bit raster
ColinD


1,993 post(s)
#30-Mar-21 12:13

In M8 I imported a DEM and saved an Aspect surface then converted the heights to 1 to 8 representing the 8 main cardinal points i.e. N, NE, E etc. Then converted to 8-bit to preserve the round numbers. These values are used in a habitat model as categorical values representative of aspect so can't be anything else than 1 to 8.

Importing or linked into M9 edge latest and they are changed to float 32 and the sequence is destroyed.

How to get around this?


Aussie Nature Shots

adamw


9,552 post(s)
#30-Mar-21 13:34

I tried to reproduce this and could not. If I create an Int8 surface in Manifold 8 and save the MAP file, then open that MAP file in Manifold 9, the result is an Int8 image. Are you opening the MAP or trying to export / import through an intermediate format? You don't have to do the latter.

ColinD


1,993 post(s)
#30-Mar-21 20:22

Ahem, I missed the important info. Exported as .asc from M8 and imported that into M9. Importing the .asc back into M8 retained the 8-bit format.


Aussie Nature Shots

adamw


9,552 post(s)
#31-Mar-21 13:32

Got it. It is impossible to tell from .ASC what the pixel type is. The file header contains no such info. The only way to tell for sure is to read the entire file and see if pixel values would fit into INT8 / UINT8 / INT16 / etc. We don't do this because this is very costly and wasteful. So instead we just use FLOAT32. (It is unclear to me why this particular dataport is using FLOAT32 instead of FLOAT64, but there are probably reasons for that as well.)

In sum: this is working as expected, if you want to preserve the type of the raster, just open the MAP without going through export and import.

Manifold User Community Use Agreement Copyright (C) 2007-2019 Manifold Software Limited. All rights reserved.