I am trying to rasterize a GeoJSON or shapely geometry but it does not rasterize all the geometry (some of it is not in the TIFF-file).

I tried gdal_rasterize -burn 255 -burn 0 -burn 0 -ts 4950 4900 src destination and also tried the rasterize function from rasterio. None of it is working.

Can someone explain how to get all the shapes in the raster?

  • 1
    Is none of it working, or some of it working? Can you give an input GeoJSON and an output Raster example. – nmtoken Nov 22 '19 at 5:30
  • Some of it is working. Most polygons of the GeoJSON get rasterized. – EAB Nov 22 '19 at 13:00
  • I guess the real question is, how do I properly set the value of ts, tr, and te. I noticed I did not have ALL_TOUCHED = True. This seemed to include the missing polygons. – EAB Nov 22 '19 at 15:32
  • Your question needs more detail about the type of geometry you are attempting to rasterise (i.e. point, line, polygon and the multi* versions, or even collections of mixed geometries). There are idiosyncrasies there. However ALL_TOCUHED is probably all you need to get what you expect. Without it, the output raster only includes cells with their centres within the input vector features (for polygons). If so, this question is a clear duplicate: gis.stackexchange.com/questions/31568/… – alphabetasoup Dec 11 '19 at 3:26
  • 1
    Did you take a look at stackoverflow.com/a/59270077/9977650? – guampi Dec 23 '19 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.