Even, Kai, Thank you both for your reply.
Adding a band.FlushCache() did not fixed the problem but it was a good point anyway. Thanks Kai. I tried to use the gdal.Rasterize() instead of gdal.RasterizeLayer() without success. There example on autotest varies quit a bit and I could not match one that works. The geojson and geotiff files have the exactly same SRS (EPSG:4326) and they overlap perfectly fine on QGIS. But it seems like the issue might be related to SRS anyway. Running the script from the Spyder IDE I was missing a warning message that now I can see by running "python script.py" on command line: Warning 1: Failed to fetch spatial reference on layer MEMORY_LAYER to build transformer, assuming matching coordinate systems. If I understood what Even said, I could fix that issue before calling gdal.RasterizeLayer() or use gdal.Rasterize() with the a transformation operation to fix the problem. I am going to work on that. Thank you again so very much, Ivan ________________________________ From: Even Rouault <[email protected]> Sent: Wednesday, July 24, 2019 10:57 AM To: [email protected] <[email protected]> Cc: Ivan Lucena <[email protected]> Subject: Re: [gdal-dev] Python RasterizeLayer and gdal_rasterize Ivan, what comes to mind is a SRS mismatch issue. From what I can see gdal.RasterizeLayer() takes a pfnTransformer / pTransformArg for that, but I'm not sure if they are probably mapped to SWIG to something practical. You might try instead with the gdal.Rasterize() "utility as a C function" that is higher level and should take care of that automagically usage examples in autotest/utilities/test_gdal_rasterize_lib.py Even -- Spatialys - Geospatial professional services http://www.spatialys.com
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
