[Gdal-dev] Segmentation fault in gdal_rasterize
mateusz at loskot.net
Wed Oct 24 12:05:03 EDT 2007
Jean-Claude Repetto wrote:
> I have downloaded a bitmap file of the world
> and a shape file of the administrative limits
> I would like to add the administrative limits to the world map by using
> I have tried this command :
> gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 0 -burn 0 -l world_factbk
> world_factbk.shp land_shallow_topo_2048.tif
> But a segmentation fault occurs. I have enabled CPL_DEBUG to get more
> debug messages. This is the result :
> GDAL: Auto register /usr/lib/gdalplugins/gdal_GRASS.so using
> OGR: Auto register /usr/lib/gdalplugins/ogr_GRASS.so using
> GRASS: OGRGRASSDataSource::Open
> GRASS: OGRGRASSDataSource::~OGRGRASSDataSource()
> OGR: OGROpen(world_factbk.shp/0x616720) succeeded as ESRI Shapefile.
> GDAL: GDALOpen(land_shallow_topo_2048.tif) succeeds as GTiff.
> 0100 - done.
> Shape: 27459 features read on layer 'world_factbk'.
> Segmentation fault
> What I am doing wrong ? (I am using the version 1.4.2 of GDAL).
The problem is in rasterizing algorithm. Spatial extent of your
shapefile spans from negative to positive values, but and rasterizer
expects a) positive values to identify range of scanline b) cooridnate
system conformance of vector and raster data used in rasterizing.
Your tif file does not have any coordinate system assigned.
So, please report a ticket for this ussue to the Trac system:
Then I will be able to track down the problem and fix.
As a workaround, I'd suggest to do following:
1. Assign coordinate system to the tif
2. Reproject it and your shapefile to non-geographical system,
so you will get all coordinates positive
3. Try to rasterize it now.
More information about the Gdal-dev