Subscribe to this thread
Home - General / All posts - How can I reclass my landuse data with Manifold 9?
enri5 post(s)
#27-May-18 09:34

After several days of studying manifold 9 by using viewer, I did not find the way to reclass my landuse data, do you know if it is possible? That is the key point for me to decide to buy it or not. Thank you very much!

Dimitri

5,083 post(s)
#27-May-18 12:08

I did not find the way to reclass my landuse data,

What do you mean by "reclass my landuse data?"

enri5 post(s)
#27-May-18 12:37

You know there are landuse codes for each class in the data saved as GRID or GeoTiff file, for example, 10 for grassland, 20 for woods. But I need to remap the codes to a different one, for example, both grassland and woods I need use 1010 to reprsent it. Just like in ARCGIS, sptial analyst reclass tool works. Sometime it is called reclassify.

Dimitri

5,083 post(s)
#27-May-18 14:27

See the Example: Trace Vector Areas from Raster Pixels topic.

A "classification" is just assigning meaning to a given code in a pixel. Create your vector areas from whatever pixels you have and then add a new column to the table with whatever values you want for each such area. Color the areas by whatever palette you want, adjusting colors to match the new codes you have in the new column.

enri5 post(s)
#27-May-18 15:06

Thank you very much for your solution, that's great for me.

A further question is: Can I export the modified vector result as a raster file, for example GeoTiff? Because I need to give the raster result to other applications.

tjhb

8,348 post(s)
#27-May-18 22:28

A further question is: Can I export the modified vector result as a raster file, for example GeoTiff? Because I need to give the raster result to other applications.

No, there is currently no vector-to-raster support in Manifold 9. (That is coming.)

But even if there were, it would be wasteful (and possibly inaccurate) to use a raster-vector-raster workflow for this task. A raster-only workflow is more natural and more efficient.

So, getting back to your original question though--how to reclassify pixels in a raster.

This is very easy in Manifold 8. It only requires a few lines of SQL. At its simplest, something like:

UPDATE [Landuse]

SET [Height (I)] =

    CASE [Height (I)]

        WHEN 10 THEN 1010

        WHEN 20 THEN 1010

        ELSE [Height (I)] -- no change

    END

;

That is readily adaptable to more detailed changes (including all of the adjustments available in the screenshot you have posted below).

However, it is currently more difficult in Manifold 9.

The underlying reason for the difference is that while Manifold 8's storage model gives direct access to individual pixels, Manifold 9 uses a storage model based on tiles (regular grids of pixels, sub-images if you like). The tile-based model is more efficient and faster. More importantly, helped by other features of Manifold 9, it is scalable to rasters of indefinite size, while the pixel-based model in 8 starts to become unwieldy if raster data does not fit within available RAM.

In many cases, analysis of tiles is also more efficient than analysis of individual pixels, because the super-scalar architecture of CPUs and, moreso, GPUs, allows simple operations to be carried out on a whole tile in one operation. (Usually the tile will be broken into smaller chunks during processing, but this is highly optimized, and each smaller chunk can be processed literally at the same time.)

A lot of simple tile-based functions are already built in to Manifold 9. Not everything is fully optimized yet, but on the whole it is already very efficient.

But so far, not everything is easy as it could be--and your task is a great example.

There is no reason why a really fast reclassification function could not be added to 9. It would be easy to specify, and I think it would parallelize very well. This is probably something we should think about and request. Possible syntax could be as simple as:

UPDATE [Landuse]

SET [Tile] = 

    TileReplace(

        TileReplace([Tile], 10, 1010),

        20, 1010)

;

to perform the same operation as the Manifold 8 code above, potentially much faster.

But for now, a "simple" reclassification operation is significantly more complex than it is in Manifold 9.

The detail is that we must use TileToValues to break each tile into a table of pixels, pass the table to a function to filter and reclassify, then* recombine adjusted pixels into a new tile, which we can then use to replace the original.

(*The filtering and reclassification can be done by either an SQL function or a script function. The second part, recombining pixels into a new tile, requires a script function, since we do not (yet?) have a buillt-in SQL function to build a new tile from a table, i.e. the reverse of TileToValues. We can only make a new tile with constant values using TileMakeNew.)

In summary, for now, it's a bit of work to do image reclassification in Manifold 9. There is plenty of room to make it significantly easier, and I am very confident that that will happen before very long--especially if we make feature requests along the necessary lines.

enri5 post(s)
#28-May-18 01:46

Thank you so much for your detailed answer which let me understand what is under-going. Anyway, If vector-to-raster support in Manifold 9 is coming, once it's available, I think that also can help me to some extent. So I am going to get Manifold 9 first , and waite for the coming features.

enri5 post(s)
#27-May-18 12:43

Just like this picture shows

Attachments:
reclass.jpg

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