Using rasterio to mask/crop a raster results in AttributeError
si.tarr@...
I'm trying to use
I also need a
I then attempt the mask with:
However, I get the error:
I have tried following this (i.e. adding my JSON to a list) but I still get the error. Can someone help me mask this raster? |
||
|
||
Hi,
You have a len = 1 list the only element of which is a string. That's what the error message tells you, essentially. Get rid of the quotes and you'l have a one-item list the which is your dict :
var2 = [{ "type": "Polygon", "coordinates": [ [ [
0.906372070312503, 52.320232076097348 ], [ 0.823974609375,
52.108192097463231 ], [ 1.170043945312496, 52.141916831668233 ], [
1.170043945312496, 52.313516199748072 ], [ 0.906372070312503,
52.320232076097348 ] ] ] }] Cheers,
|
||
|
||
Simon Tarr <si.tarr@...>
Thank you. I used the below to remove the quotes:
import ast poly = ast.literal_eval(obj.job_loc.geojson) |
||
|
||
Luke
You can also use json:
|
||
|