wiki:FAQRaster

Version 6 (modified by Mateusz Łoskot, 17 years ago) ( diff )

--

FAQ - Raster

  1. Why won't gdalwarp or gdal_merge write to most formats?
  2. How to improve gdalwarp perfomance?
  3. How to convert a raster to a layer of polygons?
  4. Can I use gdal_rasterize to generate non-solid polygons?

Why won't gdalwarp or gdal_merge write to most formats?

GDAL supports many raster formats for reading, but significantly less formats for writing. Of the ones supported for writing most are only supported in create copy mode. Essentially this means they have to be written sequentially from a provided input copy of the image to be written. Programs like gdal_merge.py or gdalwarp that write chunks of imagery non-sequentially cannot easily write to these sequential write formats. Generally speaking formats that are compressed, such as PNG, JPEG and GIF are sequential write. Also some formats require information such as the coordinate system and color table to be known at creation time and so these are also sequential write formats.

When you encounter this problem it is generally a good idea to first write the result to GeoTIFF format, and then translate to the desired target format.

To determine which formats support which capabilities, use the --formats switch with pretty much any GDAL utility. Each driver will include either r (read-only), rw (read or sequential write) or rw+ (read, sequential write or random write).

How to improve gdalwarp perfomance?

Briefly: use the warp memory and config cachemax settings. For example gdalwarp --config GDAL_CACHEMAX 500 -wm 500 uses 500MB of RAM for read/write caching, and 500MB of RAM for working buffers during the warp.

For more details see UserDocs/GdalWarp Will increasing RAM increase the speed of gdalwarp?

How to convert a raster to a layer of polygons?

TBD

Can I use gdal_rasterize to generate non-solid polygons?

See How gdal_rasterize works in gdal-dev archives.

As Chris Barker suggests, GDAL's rasterization capability is not sophisticated from a render styling point of view. Other tools may be more appropriate if you want to do anything more sophisticated than rasterize the polygons in a single solid color.

Note: See TracWiki for help on using the wiki.