Subscribe to this thread
Home - General / All posts - M9 Modifying pixels in a raster using a vector features as analysis masks
danb


1,699 post(s)
#15-May-19 05:16

I can’t remember if I have asked this before but have wanted to be able to do it for a while in M9. I have a vector feature which I want to transpose onto an image to modify or extract the overlain pixels.

Thinking of ways to do this, I know there was forum mention of a method similar to M8’s 'no interpolation' method when pasting a vector feature to a grid, but I haven’t seen anything similar in the current range of interpolators. We also now have features for performing zonal type functions collecting data under a vector feature from an overlain raster, but as far as I am aware, not the other way round.

With this in mind, is it currently possible to extract the pixels under a vector feature or interact with them such as setting their value in SQL, or is this a feature request?

Making (irregular) selections in images and modifying the pixel values in some way is a very powerful feature of M8 which I would love to see in M9.


Landsystems Ltd ... Know your land | www.landsystems.co.nz

Dimitri


5,460 post(s)
#15-May-19 05:48

If you don't mean the raster to vector interaction as shown in Example: Transfer DEM Terrain Heights to Areas in a Drawing then that would be a feature request.

tjhb

8,771 post(s)
#15-May-19 08:09

Dan means the other way around: use geometry to look up underlying pixels, then do something with the pixels.

The "something" could be (a) do raster maths, (b) create a new raster from those pixels, (c) modify an existing raster (the source raster or another) only within the scope of those pixels. (Other things?)

I tend to think selecting pixels is a red herring. It is often the most convenient method of doing those things in 8, but is not necessary in 9.

Anyway, all of these things are possible already in 9, just not as easy as they could be.

An exact example might be good, e.g. a Manifold 8 workflow with simple data. Then we can agree on how it can currently be done in 9, and how it might be made easier/more approachable.

danb


1,699 post(s)
#15-May-19 21:16

Thanks Tim. I will put together some simple data for a use case.


Landsystems Ltd ... Know your land | www.landsystems.co.nz

danb


1,699 post(s)
#16-May-19 01:00

Find attached a M8 test project. It contains main three components [VECTOR], [RASTER] and

[1 UPDATE SELECTED PIXELS].

[VECTOR] and [RASTER] are subsets taken from larger extent components in a M9 project.

[1 UPDATE SELECTED PIXELS] is the way I would approach this in M8 i.e. select all objects in [VECTOR], transfer this selection to [RASTER] and then run this query.

The M9 project creates the surface as a subset of a lidar grid including all pixels with heights <=1.8m.and all other pixels set to invisible. The vector feature is the result of a ‘Trace Areas’ transform operating on the same grid with some polygons such as those along the river removed from the resulting drawing.

For this example, all I wish to do is use Manifold 9 to update the pixels under the vector polygons with a value of 99. As Tim suggests however, I am also interested in more general cases of interactions between geom and pixels as outlined.

Attachments:
M8 FORUM.map


Landsystems Ltd ... Know your land | www.landsystems.co.nz

tjhb

8,771 post(s)
#17-May-19 01:13

Cool data!

tjhb

8,771 post(s)
#17-May-19 02:20

Here are the steps I am thinking of, with some effort at optimization.

  • Reproject areas to CS of image
  • Subdivide areas into convex parts, with relevant attribute; result to temporary table T with RTREE on part
  • Make tile boxes for image; result to temporary table U with RTREE on box
  • Filter boxes in U overlapping some part in T
  • Split filtered tiles into pixels, drawing pixel boxes; result to temporary table V with RTREE on box
  • Filter pixel boxes in V overlapping some part in T; result to temporary table W with BTREEDUP on XY tile index
  • Adjust value of joined pixels in W, applying attribute from matched part
  • Left join tiles in U to adjusted pixels in W (join on tile index)
  • Recombine joined tiles with coalesce: adjusted pixel if any, else original
  • Substitute recombined tiles for original tiles as applicable
Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.