Ticket #3202 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

BURN_VALUE_FROM option for GDALRasterizeGeometries

Reported by: xenononarcticus Owned by: chaitanya
Priority: normal Milestone: 1.7.0
Component: Algorithms Version: unspecified
Severity: normal Keywords: rasterize
Cc: warmerdam

Description

This patch defines a BURN_VALUE_FROM option for GDALRasterizeGeometries. This option instructs GDALRasterizeGeometries(0 to derive the burn value from an alternate source. Currently the only recognized source is "Z", which is the interpolated Z coordinate of the source geometry, added to the explicit padfGeomBurnValue value. This is sensible for wkb[Multi]Point and wkb[Multi]LineString? geometries but unimplemented for wkb[Multi]Polygon because interpolating Z within the filled polygon interior is extremely non-trivial.

These files are modified against a GDAL 1.6 release which does not appear to differ to greatly from the SVN trunk version.

Attachments

gdalrasterize.cpp Download (32.2 KB) - added by xenononarcticus 2 years ago.
gdal_alg_priv.h Download (3.9 KB) - added by xenononarcticus 2 years ago.
llrasterize.cpp Download (13.3 KB) - added by xenononarcticus 2 years ago.
gdalrasterizeburnztests.h Download (7.7 KB) - added by xenononarcticus 2 years ago.
Unit Test for rasterize burn Z

Change History

Changed 2 years ago by xenononarcticus

Changed 2 years ago by xenononarcticus

Changed 2 years ago by xenononarcticus

  Changed 2 years ago by warmerdam

  • cc warmerdam added
  • keywords rasterize added
  • owner changed from warmerdam to chaitanya
  • milestone set to 1.7.0

Chaitanya,

Please review and incorporate in trunk as time permits.

follow-up: ↓ 3   Changed 2 years ago by xenononarcticus

I'd like to check and see if this change is acceptable, as I'd like to get it approved so the client who requested it can integrate it into their builds via SVN.

in reply to: ↑ 2   Changed 2 years ago by chaitanya

  • status changed from new to assigned

Replying to xenononarcticus:

I'd like to check and see if this change is acceptable, as I'd like to get it approved so the client who requested it can integrate it into their builds via SVN.

I am actively working on it. I had to make some modifications due to changes between 1.6 branch and the trunk.

In the mean time I can use some sample datasets you have used to test this.

Changed 2 years ago by xenononarcticus

Unit Test for rasterize burn Z

  Changed 2 years ago by xenononarcticus

I have added gdalrasterizeburnztests.h

Include it, instantiate an GDALRasterizeBurnZTestCase object (with an arbitrary string argument to the constructor) and call the testGDALRasterizeBurnZ() method to exercise the feature.

follow-up: ↓ 6   Changed 2 years ago by xenononarcticus

Is there anything else I can do to help ensure this makes the 1.7 RC1?

in reply to: ↑ 5   Changed 2 years ago by chaitanya

Replying to xenononarcticus:

Is there anything else I can do to help ensure this makes the 1.7 RC1?

I just need to do a bit more testing. Just an hour or two. It should be done shortly.

  Changed 2 years ago by chaitanya

  • status changed from assigned to closed
  • resolution set to fixed

Patch applied to trunk in r18164.

Future work could include introducing the M value from XYM or XYZM. The filled polygons could use some help too.

  Changed 2 years ago by rouault

  • status changed from closed to reopened
  • resolution fixed deleted

Chaintanyach,

* I don't see the point of having GDALBurnValueSrc enum and GDALRasterizeInfo struct definition in gdal_alg.h, which is a public header (and thus subject to backward compatibility issues), whereas they look to be only used byte implementation code. I think they might be better placed in a private header like gdal_alg_priv.h.

* the comment '<dt>"BURN_VALUE_FROM":</dt> <dd>May be set to GDALBurnValueSrc.GBV_Z to use the Z values of the geometries...' is found twice in the changeset and doesn't seem appropriate. papszOptions is an array of strings. The user of the API cannot assign a numeric enum value for the BURN_VALUE_FROM option. So from the user point of view, the appropriate value is "Z" instead, no ?

* the new capability should be tested in the autotest suite.

  Changed 2 years ago by chaitanya

Moved the GDALBurnValueSrc enum and GDALRasterizeInfo struct definitions from gdal_alg.h to gdal_alg_priv.h in trunk. (r18227)

  Changed 2 years ago by chaitanya

  • status changed from reopened to closed
  • resolution set to fixed

Applied patch r18340 to trunk.

It adds the functionality to polygons. However, it just uses the Z value from the first point and uses it throughout the polygon.

Added test rasterize_3 in autotest/alg/rasterize.py.

Note: See TracTickets for help on using tickets.