Thank you for your reponse.
Even Rouault-2 wrote
> I can't reproduce your issue with the file not being terminated with ]}
> Hum maybe this is due to trying to append several layers with layers[1:]
> syntax. You should
> Note that currently layers must be provided with an array, and not without
> a string
> (otherwise it iterates over each character of the string...) This is a
> defect I'm going to fix.
> Note also that the 'overwrite' mode is without effect here (and will
> actually not do what you
> want). overwrite is for multi-layer datasets where you want to overwrite
> an existing layer. In
> the GeoJSON driver, this is not implemented. You should just remove it and
> in that case the
> whole file will be overwritten.
You're right of course about 'layers' not accepting a string if you try to
specify a single layer, i noticed that mistake in my code later on as well.
Its not affecting the behavior i'm experiencing. I work in the Jupyter
Notebook and that moves you away from the console where the GDAL warnings
are printed, which is why i didn't noticed it right away. GDAL prints a nice
'ERROR 1: Couldn't fetch requested layer 'a'!' warning which makes the
sliced string obvious.
Even Rouault-2 wrote
> Actually I've just tested the following successfully (with trunk)
> from osgeo import gdal
> gdal.VectorTranslate('out.json', 'src', layerName = 'outlayer', format =
> accessMode='append', layers = ['poly', 'poly2', 'poly3'])
Good to know that it should work like that, i started off with something
After some more trial and error i think I've found whats wrong. I was first
really focused on the keyword options, hence trying all access modes etc.
It turns out that its more a flushing/releasing issue, perhaps in
combination with the Jupyter Notebook (holding a reference to the object?).
If i display the returned dataset, Jupyter displays the string 'repr'. I do
this all the time with GDAL datasets just to confirm i actually have a
dataset, whereas a failed command would result in "None".
But somehow, in this case, closing the dataset with "ds = None" fails to
release the file handle (and doesnt flush?), but only when let Jupyter
display the dataset (repr). If i close the dataset right away, it works as
Here is a notebook showing what i did:
Is the method which doesn't work something that should work, or is it simply
bad practice? I'm pretty sure i do this with the raster utilities all the
time, without any problems.
View this message in context:
Sent from the GDAL - Dev mailing list archive at Nabble.com.
gdal-dev mailing list