<div dir="ltr">Even,<div><br></div><div>Thanks for the pointers.  I will do touchups on the driver tutorial as I go.</div><div><br></div><div>Maybe more specifically, with the initial setup of the driver and the datasource:</div><div><br></div><div>I only see two drivers that use GDALDriver.</div><div><br></div><div><div>grep class */*.{cpp,h} | grep GDALDriver</div><div>db2/ogr_db2.h:class OGRDB2Driver : public GDALDriver</div><div>s57/ogr_s57.h:class OGRS57Driver : public GDALDriver</div></div><div><br></div><div>Most OGR drivers do:</div><div><br></div><div>GDALDriver *poDriver = new GDALDriver();<br></div><div><br></div><div>But others do:</div><div><br></div><div><div>gmt/ogrgmtdriver.cpp:    OGRSFDriver* poDriver = new OGRGmtDriver;</div></div><div><div>idb/ogridbdriver.cpp:    OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver(new OGRIDBDriver);</div></div><div><br></div><div>What's the cleanest way to setup the driver registration?</div><div><br></div><div>Should I be deriving from GDALDataset?</div><div><br></div><div>And a few do:</div><div><br></div><div><div>egrep class */*.{cpp,h} | grep public | egrep -i GDALDataset | head -7</div><div>geojson/ogrgeojsondriver.cpp:class OGRESRIFeatureServiceDataset: public GDALDataset</div><div>gmlas/ogrgmlaswriter.cpp:class GMLASFakeDataset : public GDALDataset</div><div>mongodb/ogrmongodbdriver.cpp:class OGRMongoDBDataSource: public GDALDataset</div><div>cad/ogr_cad.h:class GDALCADDataset : public GDALDataset</div><div>elastic/ogr_elastic.h:class OGRElasticDataSource : public GDALDataset</div><div>gmlas/ogr_gmlas.h:class OGRGMLASDataSource: public GDALDataset</div><div>jml/ogr_jml.h:class OGRJMLDataset : public GDALDataset</div></div><div><br></div><div><div>But most do:</div></div><div><br></div><div><div>egrep class */*.{cpp,h} | grep public | egrep -i OGRDataSource | head -5</div><div>csw/ogrcswdataset.cpp:class OGRCSWDataSource : public OGRDataSource</div><div>generic/ogremulatedtransaction.cpp:class OGRDataSourceWithTransaction : public OGRDataSource</div><div>null/ogrnulldriver.cpp:class OGRNULLDataSource : public OGRDataSource</div><div>aeronavfaa/ogr_aeronavfaa.h:class OGRAeronavFAADataSource : public OGRDataSource</div><div>amigocloud/ogr_amigocloud.h:class OGRAmigoCloudDataSource : public OGRDataSource</div><div><br></div><div>egrep class */*.{cpp,h} | grep public | egrep -i OGRDataSource | wc -l <br></div><div>     80</div></div><div><br></div><div>OGRDataSource is deprecated and new drivers should derive from GDALDataset, yes?<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 15, 2017 at 7:37 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div style="font-family:'Sans Serif';font-size:9pt;font-weight:400;font-style:normal"><span class="">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">On mercredi 15 février 2017 07:19:43 CET Kurt Schwehr wrote:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Hey all,</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> What are the top couple vector drivers in terms of being up-to-date w.r.t.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> API changes?  I'm finally trying to start into adding code and I've got a</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> couple vector drivers I'd like to write.  I've started reading RFC 46</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> (GDAL/OGR unification), but I'm trying to figure out the cleanest setup of</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> the driver, data source and layers classes.  I've spent tons of time with</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> line by line issues, but that gives me very little sense of where we want</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> GDAL vector drivers to converge to.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Thoughts on what are the best couple drivers to pattern after?</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</span><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Kurt,</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">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.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Basically start writing GetNextFeature() and implement other methods if they make sense for the format. Skimming quickly through <a href="http://gdal.org/ogr_drivertut.html" target="_blank">http://gdal.org/ogr_drivertut.<wbr>html</a>, it seems to be a good starting point (as you make progress in your journey, updating it might be a good idea)</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">For real world examples, I think the SUA or BNA drivers must be among the most simple ones.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Even</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">-- </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Spatialys - Geospatial professional services</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a></p></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">--<div><a href="http://schwehr.org" target="_blank">http://schwehr.org</a></div></div>
</div>