[gdal-dev] ogr.VectorTranslate to json appears to be incomplete

Michael Smith michael.smith.erdc at gmail.com
Fri May 26 10:53:42 PDT 2023


Yes! That is it. It explains so much. Thanks for figuring this out. I learned something important today.


-- 

Michael Smith 
Remote Sensing/GIS Center 
US Army Corps of Engineers 





On 5/26/23, 1:48 PM, "gdal-dev on behalf of Even Rouault" <gdal-dev-bounces at lists.osgeo.org <mailto:gdal-dev-bounces at lists.osgeo.org> on behalf of even.rouault at spatialys.com <mailto:even.rouault at spatialys.com>> wrote:




Le 26/05/2023 à 19:40, Laurențiu Nicola via gdal-dev a écrit :
> It's a bit strange, I can reproduce it when pasting into the REPL, but not when running from a file.


yes, the issue must come from the fact that gdal.VectorTranslate() 
returns a gdal.Dataset handle that is still active, and you could 
potentially add new features to it, hence the closing "] }" are emitted 
just when it is closed. In an interactive shell, for some reason the 
gdal.Dataset handle is not immediately closed when 
gdal.VectorTranslate() returns.


A safer way would be to explicitly do:


out_ds = gdal.VectorTranslate(...)


del out_ds


before getting the file content


>
> Laurentiu
>
> On Fri, May 26, 2023, at 20:27, Michael Smith wrote:
>> Well, a new install of gdal from conda-forge and now it works fine.
>> Sorry for the noise.
>>
>> Mike
>>
>>
>> -- 
>>
>> Michael Smith
>> Remote Sensing/GIS Center
>> US Army Corps of Engineers
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/gdal-dev <https://lists.osgeo.org/mailman/listinfo/gdal-dev>


-- 
http://www.spatialys.com <http://www.spatialys.com>
My software is free, but my time generally not.


_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev <https://lists.osgeo.org/mailman/listinfo/gdal-dev>






More information about the gdal-dev mailing list