In the code below, I'm trying to rasterize "roads" and "cube" to 128x128 pixels with a 10m spatial resolution for each pixel. First, I want to rasterize roads separately to make them look better by using the option "all_touched"=True. And then I want to merge them to the same raster.
How do I use the option "all_touched=True"?
for idx,row in enumerate(clip.itertuples()):
if row.code_2018 !=None:
train_id[idx]=(class_dic[str(row.code_2018)]['train_id'])
clip = clip.assign(train_id=train_id)
roads=clip.code_2018.isin(['12210','12220','12230'])
roads = clip[roads]
cube = make_geocube(
vector_data=clip,
measurements=['train_id'],
resolution=(10,-10)
)
roads = make_geocube(
vector_data=roads,
measurements=['train_id'],
resolution=(10,-10)
)
break
![[![want to merge these][1]][1]
[1]: https://i.stack.imgur.com/hOUbu.png](../../images/c3055b73e93188b09a1f90a2582212c9.webp)