I have the following polygon:

POLYGON ((539500.00004634191 6314429.5954758488,539499.999 
6314429.5964747742,539500.0 6314500.001,539563.49086194986 
6314500.001,539574.70556674246 6314491.5008581309,539591.23494657199 
6314478.9664945751,539600.001 6314472.1168122729,539600.00014411798 
6314460.5601839637,539543.07124903298 6314452.2691510962,539546.30058158806 
6314438.619163854,539507.3702219734 6314429.939004397,539505.68004823104 
6314429.8589810915,539500.00004634191 6314429.5954758488))

I have created a memory vector layer and added this polygon as the only feature.

    projection = ...
    geometry = ...
    ogr_mem_drv = ogr.GetDriverByName('Memory')

    mem_vector_ds = ogr_mem_drv.CreateDataSource('')
    mem_vector_layer = mem_vector_ds.CreateLayer('', srs=projection)
    feature = ogr.Feature(mem_vector_layer.GetLayerDefn())
    feature.SetGeometry(geometry.Clone())
    mem_vector_layer.CreateFeature(feature)

    gdal_mem_drv = gdal.GetDriverByName('MEM')
    mem_raster_ds = gdal_mem_drv.Create('',5,5,1,gdal.GDT_Byte)
    mem_raster_ds.SetGeoTransform([...])
    mem_raster_ds.SetProjection(mem_vector_layer.GetSpatialRef().ExportToWkt())

    err = gdal.RasterizeLayer(mem_raster_ds, [1], mem_vector_layer, None, None, 
[1], ['ALL_TOUCHED=TRUE'])

When running the last line with gdal.RasterizeLayer(...) my program waits a 
couple of seconds and then just terminates without any exception or error.

If  I remove vertex number two from the above WKT it works. Vertex 1 and 2 are 
very close (located in the lower left corner of the polygon).

I am running GDAL 1.10.1 and Python 3.2, builds are stable releases from 
http://www.gisinternals.com/sdk/.

What could be the reason for this strange error?


Kind regards, Casper
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to