Good news indeed, thanks Even! Best, Jesse
Lead Computer Scientist Science Systems and Applications, Inc. Dr Compton Tucker Team NASA Goddard Space Flight Center From: Even Rouault <even.roua...@spatialys.com> Date: Friday, October 18, 2024 at 5:46 PM To: Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] <jesse.r.me...@nasa.gov>, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev <gdal-dev@lists.osgeo.org> Subject: [EXTERNAL] Re: [gdal-dev] OGR support in gdal.x functions CAUTION: This email originated from outside of NASA. Please take care when clicking links or opening attachments. Use the "Report Message" button to report suspicious messages to the NASA SOC. Jesse, Le 18/10/2024 à 21:15, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev a écrit : We have a bunch of legacy code that uses from osgeo import gdal, ogr, where raster datasets are created with gdal and vector datasets with ogr. However, these don’t mix well when, say, rasterizing a vector dataset with gdal.rasterize. The ‘workaround’ is to create a vector dataset using gdal: vector_ds = gdal.GetDriverByName("Memory").Create(“”, 0, 0, 0, gdal.GDT_Unknown) But this is arcane and quite unintuitive. Admitedly true, although the "recommended" way since the GDAL 2.0 GDAL and OGR unification, at least on the C/C++ side of things. The good news is that in GDAL 3.10 in Python bindings as well, ogr.DataSource is just now an alias of gdal.Dataset, so you can use ogr.GetDriverByName(...).CreateDataSource(...) as a valid gdal.Dataset >>> from osgeo import ogr >>> ds = ogr.GetDriverByName('Memory').CreateDataSource('') >>> ds <osgeo.gdal.Dataset; proxy of <Swig Object of type 'GDALDatasetShadow *' at 0x7fc32f3d9600> > Even -- http://www.spatialys.com<http://www.spatialys.com/> My software is free, but my time generally not. Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev