[gdal-dev] Utilisation de Planetary Computer
Loïc Lozac'h
loic.lozach at inrae.fr
Wed Sep 28 01:05:44 PDT 2022
Bonjour,
Est-il possible d'utiliser la signature de la librairie python
Planetary_Computer pour lire des COG depuis le catalogue STAC Microsoft ?
J'ai essayé plusieurs méthode en utilisant /vsicurl/ mais les extended
filenames associé à la signature ne sont pas reconnu.
Est-il possible de lire ces données à la manière de RasterIO ?
J'utilise gdal version 3.5.2
code python en erreur :
vsistr= "/vsicurl?pc_url_signing=yes&pc_collection=sentinel-2-l2a&url="
red_href= vsistr+ planetary_computer.sign(item).assets["B04"].href
cogtif= gdal.Open( red_href)
response :
Warning 6: Unsupported option: se
Warning 6: Unsupported option: sp
Warning 6: Unsupported option: sv
Warning 6: Unsupported option: sr
Warning 6: Unsupported option: skoid
Warning 6: Unsupported option: sktid
Warning 6: Unsupported option: skt
Warning 6: Unsupported option: ske
Warning 6: Unsupported option: sks
Warning 6: Unsupported option: skv
Warning 6: Unsupported option: sig
ERROR 11: HTTP response code: 403
code python ok :
withfiona.open(shp, "r") asshapefile:
shapes= [feature["geometry"] forfeatureinshapefile]
withrasterio.open(planetary_computer.sign(item).assets["B04"].href ) asds:
out_image, out_transform= rasterio.mask.mask(ds, shapes, crop=True)
out_meta= ds.meta
out_meta.update({"driver": "GTiff",
"height": out_image.shape[1],
"width": out_image.shape[2],
"transform": out_transform})
withrasterio.open(out, "w", **out_meta) asdest:
dest.write(out_image)
Merci pour vos réponses
Bien cordialement,
Loïc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220928/5f54c537/attachment.htm>
More information about the gdal-dev
mailing list