<div dir="auto">ah thanks, all very helpful - no it's not done with master (for various reasons), I'll follow up with details if relevant, mostly I was just excited to get a useable workflow for the entire process.<div dir="auto"><br></div><div dir="auto">Cheers, Mike</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 30 Jan 2024, 22:46 Even Rouault, <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div>
    <p>Michael,</p>
    <p>You need to attach the CRS at layer creation time with:<br>
    </p>
    <p>layer = ds.CreateLayer(layer_name, geom_type=ogr.wkbPolygon,
      srs=sr)</p>
    <p>Setting it with featureDefn.GetGeomFieldDefn(0).SetSpatialRef()
      is illegal. Now that
<a href="https://gdal.org/development/rfc/rfc97_feature_and_fielddefn_sealing.html" target="_blank" rel="noreferrer">https://gdal.org/development/rfc/rfc97_feature_and_fielddefn_sealing.html</a>
      has been implemented, you should have got an error... (assuming
      you run your script with recent GDAL master)</p>
    <p>from osgeo import ogr<br>
      ogr.UseExceptions()<br>
      ds = ogr.GetDriverByName('ESRI
      Shapefile').CreateDataSource('/tmp/foo.shp')<br>
      lyr = ds.CreateLayer('foo')<br>
      from osgeo import osr<br>
      sr = osr.SpatialReference()<br>
      sr.SetFromUserInput("OGC:CRS84")<br>
      featureDefn = lyr.GetLayerDefn()<br>
      featureDefn.GetGeomFieldDefn(0).SetSpatialRef(sr)<br>
      Traceback (most recent call last):<br>
        File "<stdin>", line 1, in <module><br>
        File
      "/home/even/gdal/gdal/build_cmake/swig/python/osgeo/ogr.py", line
      6017, in SetSpatialRef<br>
          return _ogr.GeomFieldDefn_SetSpatialRef(self, *args)<br>
      RuntimeError: OGRGeomFieldDefn::SetSpatialRef() not allowed on a
      sealed object<br>
      <br>
    </p>
    <p>I can't think of a reason why your script wouldn't work with a
      FlatGeoBuf output (did you get an error message?), which would be
      much better, as you could also attach the XRES, YRES, BANDCOUNT,
      etc. metadata items that would help the GTI driver avoid probing
      one of the tiles.<br>
    </p>
    <p>Even<br>
    </p>
    <div>Le 30/01/2024 à 12:31, Michael Sumner a
      écrit :<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">awesome, thanks Even I'm having fun with this one. 
        <div><br>
        </div>
        <div>For anyone interested I created Python to parse the
          OpenTopography COP90 VRT (I have to wget it locally as I don't
          know how to hit the URL for the xml yet). </div>
        <div><br>
        </div>
        <div><a href="https://github.com/mdsumner/cog-example/blob/1ca74f3baffe69830180031ddabcbbc569816150/gti/cop90.py" target="_blank" rel="noreferrer">https://github.com/mdsumner/cog-example/blob/1ca74f3baffe69830180031ddabcbbc569816150/gti/cop90.py</a><br>
        </div>
        <div><br>
        </div>
        <div>(I'm using the DstRect to get efficient extent polygon of
          each tif without opening them). </div>
        <div><br>
        </div>
        <div>This writes a cop90.shp which can be GTI'd via </div>
        <div><br>
        </div>
        <div>gdalinfo GTI:/vsicurl/<a href="https://github.com/mdsumner/cog-example/raw/main/gti/cop90.shp" target="_blank" rel="noreferrer">https://github.com/mdsumner/cog-example/raw/main/gti/cop90.shp</a><br>
        </div>
        <div><br>
        </div>
        <div>(seems I didn't get the SRS attached correctly). </div>
        <div><br>
        </div>
        <div>I also have an R script in there for COP30 that I did
          previously to FlatGeoBuf, I couldn't get FlatGeoBuf to work
          from Python and don't know why. </div>
        <div><br>
        </div>
        <div>If there's any pythonic-idiomatic advice on my code I'm
          very interested, slowly I'll try to use this to do the same in
          C++.  If there's a faster way to get these extents with GDAL
          I'm also keen to hear, thanks! </div>
        <div><br>
        </div>
        <div>Cheers, Mike</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Jan 26, 2024 at
          10:19 PM Even Rouault via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank" rel="noreferrer">gdal-dev@lists.osgeo.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
          <br>
          the driver has recently landed into GDAL master, renamed as
          GTI: <br>
          <a href="https://gdal.org/drivers/raster/gti.html" rel="noreferrer noreferrer" target="_blank">https://gdal.org/drivers/raster/gti.html</a><br>
          <br>
          Can be tested using <br>
          <a href="https://gdal.org/download.html#gdal-master-conda-builds" rel="noreferrer noreferrer" target="_blank">https://gdal.org/download.html#gdal-master-conda-builds</a>
          , the refreshed <br>
          <a href="http://ghcr.io/osgeo/gdal" rel="noreferrer noreferrer" target="_blank">ghcr.io/osgeo/gdal</a>
          Docker image, or other nightly builds of GDAL master<br>
          <br>
          Even<br>
          <br>
          Le 20/12/2023 à 19:33, Even Rouault via gdal-dev a écrit :<br>
          > Hi,<br>
          ><br>
          > For those not actively following github tickets & PR,
          I just want to <br>
          > point to a new pending major functionality to improve
          management of <br>
          > virtual mosaics with a very large number of tiles/sources
          (> tens of <br>
          > thousands of tiles), by referencing them as features of a
          vector layer <br>
          > (typically created by gdaltindex), instead of a XML file
          as in <br>
          > traditional VRT, augmented with additional metadata.<br>
          ><br>
          > More details in <a href="https://github.com/OSGeo/gdal/pull/8983" rel="noreferrer noreferrer" target="_blank">https://github.com/OSGeo/gdal/pull/8983</a>
          (and in <br>
          > initial ticket in <a href="https://github.com/OSGeo/gdal/issues/8861" rel="noreferrer noreferrer" target="_blank">https://github.com/OSGeo/gdal/issues/8861</a>)<br>
          ><br>
          > Even<br>
          ><br>
          -- <br>
          <a href="http://www.spatialys.com" rel="noreferrer noreferrer" target="_blank">http://www.spatialys.com</a><br>
          My software is free, but my time generally not.<br>
          <br>
          _______________________________________________<br>
          gdal-dev mailing list<br>
          <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank" rel="noreferrer">gdal-dev@lists.osgeo.org</a><br>
          <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      <span class="gmail_signature_prefix">-- </span><br>
      <div dir="ltr" class="gmail_signature">Michael Sumner<br>
        Software and Database Engineer<br>
        Australian Antarctic Division<br>
        Hobart, Australia<br>
        e-mail: <a href="mailto:mdsumner@gmail.com" target="_blank" rel="noreferrer">mdsumner@gmail.com</a></div>
    </blockquote>
    <pre cols="72">-- 
<a href="http://www.spatialys.com" target="_blank" rel="noreferrer">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </div>

</blockquote></div>