Opened 12 years ago

Closed 12 years ago

#3202 closed enhancement (fixed)

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 (4)

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

Download all attachments as: .zip

Change History (14)

Changed 12 years ago by xenononarcticus

Attachment: gdalrasterize.cpp added

Changed 12 years ago by xenononarcticus

Attachment: gdal_alg_priv.h added

Changed 12 years ago by xenononarcticus

Attachment: llrasterize.cpp added

comment:1 Changed 12 years ago by warmerdam

Cc: warmerdam added
Keywords: rasterize added
Milestone: 1.7.0
Owner: changed from warmerdam to chaitanya

Chaitanya,

Please review and incorporate in trunk as time permits.

comment:2 Changed 12 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.

comment:3 in reply to:  2 Changed 12 years ago by chaitanya

Status: newassigned

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 12 years ago by xenononarcticus

Attachment: gdalrasterizeburnztests.h added

Unit Test for rasterize burn Z

comment:4 Changed 12 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.

comment:5 Changed 12 years ago by xenononarcticus

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

comment:6 in reply to:  5 Changed 12 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.

comment:7 Changed 12 years ago by chaitanya

Resolution: fixed
Status: assignedclosed

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.

comment:8 Changed 12 years ago by Even Rouault

Resolution: fixed
Status: closedreopened

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.

comment:9 Changed 12 years ago by chaitanya

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

comment:10 Changed 12 years ago by chaitanya

Resolution: fixed
Status: reopenedclosed

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.