MapInfo Pro

 View Only
  • 1.  Edit classified Raster

    Posted 11-07-2022 22:11
    Hello,

    I have a classified Raster in which I'd like to make some minor changes.
    As an example, replace a couple of green pixel by pink pixel.... forest by residential class.


    I can't an option to edit cells.. so I used another way to create a polygon, gives an attribute (residential).
    I rasterized it.. until then all good.
    Then went into merging the raster with stamp.

    This is where things are not getting right.
    The existing residential got renamed to residential_1 and the replaced pixel by residential_2.

    That's really what I was expecting... was hoping to get residential.

    Any suggestion how to do this please?

    thanks






    ------------------------------
    Alban Spella-Barberet
    NBN Co Limited
    North Sydney NSW
    ------------------------------


  • 2.  RE: Edit classified Raster

    Posted 11-08-2022 17:31
    One other option, and I am not suggesting it is a good one for a second, is to use the raster calculator operation.

    I tested it on a small classified raster in MRR format and it worked. If your raster is in Vertical Mapper GRC or GeoTIFF format that is an additional unknown.

    You can use an expression like this - 

    cond((GetX()=527262.5 and GetY()=180412.5) or (GetX()=527287.5 and GetY()=180437.5),0,Class)

    GetX() and GetY() return the coordinate at the centre of every grid cell. So in this expression, I have targeted two cells and I change the value of the zero-based class index to 0. In my raster (UK land use), it flips two cells from "Urban" to "Broadleaved Woodland".

    The problems include - 

    • If your raster cell size is some nasty number or your cell origin is not some nice number, then working out what the coordinate is at the centre of the cell and expressing it exactly in the calculator might be tricky or impossible.
    • You need to specify the zero-based index of the new class. In my case, it was zero. To find out you need to look at the classification table in Pro (via the Raster Info) and then count down the rows from zero.
    • I did not consider null values in my expression. Maybe that does not matter.
    • You might only be able to fix a few cells with one expression because otherwise, it would get too long. On the other hand, you could specify a rectangular range of cells and change a larger block with one expression.
    • Obviously, it is not an efficient way to edit individual cells in a raster.


    ------------------------------
    Sam Roberts
    Founder, Roberts Geospatial Engineering
    Australia
    ------------------------------



  • 3.  RE: Edit classified Raster

    Posted 11-08-2022 18:27
    Thanks Sam, hopefully @Peter Møller and team might have a good first option :)


    ------------------------------
    Alban Spella-Barberet
    NBN Co Limited
    North Sydney NSW
    ------------------------------