Opened 11 years ago

Closed 11 years ago

#5218 closed defect (invalid)

GDALRasterizeLayers with ALL_TOUCHED and ATTRIBUTE options

Reported by: royeral Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.10.0
Severity: normal Keywords:
Cc:

Description (last modified by royeral)

I have a river layer and a lake layer (shapefile) that I rasterize with GDALRasterizeLayers to GeoTIFF. With the ALL_TOUCHED option, all the pixels of the layers are rasterize. With the ALL_TOUCHED and ATTRIBUTE options, lots of pixels are missing.

I'm using GDAL version 1.10 in C++.

https://skydrive.live.com/redir?resid=7ECAD65B80CFE693!18543

char** options = nullptr;

options = CSLSetNameValue(options, "ALL_TOUCHED", "TRUE");
options = CSLSetNameValue(options, "ATTRIBUTE", "ID");
	
GDALRasterizeLayers(dst_dataset, 1, &band_list[0], 2, (OGRLayerH*)&layers[0], NULL, NULL, NULL, options, NULL, NULL);

CSLDestroy(options);

(sorry for my English, I'm french canadian)

Attachments (2)

Capture_ALL_TOUCHED.PNG (124.8 KB ) - added by royeral 11 years ago.
Capture_ATTRIBUTE.PNG (115.3 KB ) - added by royeral 11 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by royeral, 11 years ago

Component: defaultGDAL_Raster

comment:2 by royeral, 11 years ago

Description: modified (diff)

comment:3 by Kyle Shannon, 11 years ago

royeral, Could you be a little more specific? I can't reproduce any obvious issues with 1.10.0 or 1.10.1. Running your code and visually inspecting the data in QGIS seems to show reasonable results.

by royeral, 11 years ago

Attachment: Capture_ALL_TOUCHED.PNG added

by royeral, 11 years ago

Attachment: Capture_ATTRIBUTE.PNG added

in reply to:  3 comment:4 by royeral, 11 years ago

Replying to kyle:

I have uploaded two pictures. Capture_ALL_TOUCHED.png is the result when I'm using the ALL_TOUCHED option and Capture_ATTRIBUTE.png is the result with ALL_TOUCHED and ATTRIBUTE options. You can see that in the ATTRIBUTE picture, lots of pixels are missing.

comment:5 by Kyle Shannon, 11 years ago

royeral, Are you sure it's not a display issue? ALL_TOUCHED has values of 1 and 2, while ALL_TOUCHED_ATTRIBUTE has a much greater range(1-788). That would explain why pixels are disappearing. It looks similar when I initially open it in QGIS, but if I reclassify the data, it looks fine. I did q quick check with gdallocationinfo on a pixel that *looked* (I don't have real data) like it was 'disappearing:

kyle@kyle-hp-laptop:5218$ gdallocationinfo -geoloc -valonly ALL_TOUCHED.tif 575726.141375, 5387281.225
1
kyle@kyle-hp-laptop:5218$ gdallocationinfo -geoloc -valonly ALL_TOUCHED_AND_ATTRIBUTE.tif 575726.141375, 5387281.225
649

and everything looked okay (valid burn values in both). You can try a similar test if you get the coordinates of a pixel that appears to not be burnt.

in reply to:  5 comment:6 by royeral, 11 years ago

Replying to kyle:

wow ! You are right ! I'm sorry. How can I close the ticket ?

Thank you very much !

royeral, Are you sure it's not a display issue? ALL_TOUCHED has values of 1 and 2, while ALL_TOUCHED_ATTRIBUTE has a much greater range(1-788). That would explain why pixels are disappearing. It looks similar when I initially open it in QGIS, but if I reclassify the data, it looks fine. I did q quick check with gdallocationinfo on a pixel that *looked* (I don't have real data) like it was 'disappearing:

kyle@kyle-hp-laptop:5218$ gdallocationinfo -geoloc -valonly ALL_TOUCHED.tif 575726.141375, 5387281.225
1
kyle@kyle-hp-laptop:5218$ gdallocationinfo -geoloc -valonly ALL_TOUCHED_AND_ATTRIBUTE.tif 575726.141375, 5387281.225
649

and everything looked okay (valid burn values in both). You can try a similar test if you get the coordinates of a pixel that appears to not be burnt.

comment:7 by Kyle Shannon, 11 years ago

Resolution: invalid
Status: newclosed

No problem, I'll close it right now. Closing as invalid.

Note: See TracTickets for help on using tickets.