[gdal-dev] using an in-memory file as -cutline argument in gdalwarp
Even Rouault
even.rouault at spatialys.com
Wed Mar 31 06:43:14 PDT 2021
Joaquim,
yes, you should be able to use a /vsimem/ file as a cutline dataset.
Here's an example in Python with a shapefile in /vsimem/:
https://github.com/OSGeo/gdal/blob/fec15b146f8a750c23c5e765cac12ed5fc9c2b85/autotest/utilities/test_gdalwarp_lib.py#L1103
The cutlineDSName=is just python syntaxic sugar to format the arguments.
There's no reason it shouldn't work in Julia too
Make sure that the cutline dataset is properly closed, before using it
with gdalwarp
Even
Le 31/03/2021 à 15:34, Joaquim Manuel Freire Luís a écrit :
>
> I have low hopes on this one but have to confirm.
>
> I have this “ds” dataset with one polygon geometry, which is correctly
> saved on disk with
>
> ogr2ogr(ds, save="lixo.gmt")
>
> and later correctly “cutlines” with
>
> gdalwarp("IMG_9106.jpg", ["-cutline", "lixo.gmt", "-to",
> "SRC_METHOD=NO_GEOTRANSFORM"]);
>
> but I wanted to avoid the step of saving to disk and instead using the
> inMemory file. If I ask its name, I see
>
> GDALGetDescription(ds.ptr)
>
> "/vsimem/##258"
>
> But this fails
>
> gdalwarp("IMG_9106.jpg", ["-cutline", GDALGetDescription(ds.ptr),
> "-to", "SRC_METHOD=NO_GEOTRANSFORM"])
>
> NULL Dataset
>
> Can this be made to work (would it work with the python bindings?) and
> I’m just doing it wrong or it just can’t?
>
> Thanks
>
> Joaquim
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210331/ebf1d380/attachment.html>
More information about the gdal-dev
mailing list