[gdal-dev] Best vector driver?

Kurt Schwehr schwehr at gmail.com
Wed Feb 15 08:27:06 PST 2017


Even,

Thanks for the pointers.  I will do touchups on the driver tutorial as I go.

Maybe more specifically, with the initial setup of the driver and the
datasource:

I only see two drivers that use GDALDriver.

grep class */*.{cpp,h} | grep GDALDriver
db2/ogr_db2.h:class OGRDB2Driver : public GDALDriver
s57/ogr_s57.h:class OGRS57Driver : public GDALDriver

Most OGR drivers do:

GDALDriver *poDriver = new GDALDriver();

But others do:

gmt/ogrgmtdriver.cpp:    OGRSFDriver* poDriver = new OGRGmtDriver;
idb/ogridbdriver.cpp:
 OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver(new OGRIDBDriver);

What's the cleanest way to setup the driver registration?

Should I be deriving from GDALDataset?

And a few do:

egrep class */*.{cpp,h} | grep public | egrep -i GDALDataset | head -7
geojson/ogrgeojsondriver.cpp:class OGRESRIFeatureServiceDataset: public
GDALDataset
gmlas/ogrgmlaswriter.cpp:class GMLASFakeDataset : public GDALDataset
mongodb/ogrmongodbdriver.cpp:class OGRMongoDBDataSource: public GDALDataset
cad/ogr_cad.h:class GDALCADDataset : public GDALDataset
elastic/ogr_elastic.h:class OGRElasticDataSource : public GDALDataset
gmlas/ogr_gmlas.h:class OGRGMLASDataSource: public GDALDataset
jml/ogr_jml.h:class OGRJMLDataset : public GDALDataset

But most do:

egrep class */*.{cpp,h} | grep public | egrep -i OGRDataSource | head -5
csw/ogrcswdataset.cpp:class OGRCSWDataSource : public OGRDataSource
generic/ogremulatedtransaction.cpp:class OGRDataSourceWithTransaction :
public OGRDataSource
null/ogrnulldriver.cpp:class OGRNULLDataSource : public OGRDataSource
aeronavfaa/ogr_aeronavfaa.h:class OGRAeronavFAADataSource : public
OGRDataSource
amigocloud/ogr_amigocloud.h:class OGRAmigoCloudDataSource : public
OGRDataSource

egrep class */*.{cpp,h} | grep public | egrep -i OGRDataSource | wc -l
     80

OGRDataSource is deprecated and new drivers should derive from GDALDataset,
yes?

On Wed, Feb 15, 2017 at 7:37 AM, Even Rouault <even.rouault at spatialys.com>
wrote:

> On mercredi 15 février 2017 07:19:43 CET Kurt Schwehr wrote:
>
> > Hey all,
>
> >
>
> > What are the top couple vector drivers in terms of being up-to-date
> w.r.t.
>
> > API changes? I'm finally trying to start into adding code and I've got a
>
> > couple vector drivers I'd like to write. I've started reading RFC 46
>
> > (GDAL/OGR unification), but I'm trying to figure out the cleanest setup
> of
>
> > the driver, data source and layers classes. I've spent tons of time with
>
> > line by line issues, but that gives me very little sense of where we want
>
> > GDAL vector drivers to converge to.
>
> >
>
> > Thoughts on what are the best couple drivers to pattern after?
>
>
>
> Kurt,
>
>
>
> There's no such thing as the best driver. It depends pretty much on the
> capabilities of the format you want to write a driver for. The most feature
> full drivers (SQLite, GeoPackage, PostGIS, ...) tend to be the ones the
> most difficult to understand. And for other drivers, you will get lost in
> the code that deals with the format itself rather than the driver structure.
>
>
>
> Basically start writing GetNextFeature() and implement other methods if
> they make sense for the format. Skimming quickly through
> http://gdal.org/ogr_drivertut.html, it seems to be a good starting point
> (as you make progress in your journey, updating it might be a good idea)
>
> For real world examples, I think the SUA or BNA drivers must be among the
> most simple ones.
>
>
>
> Even
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>



-- 
--
http://schwehr.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170215/db9ad0eb/attachment.html>


More information about the gdal-dev mailing list