<div dir="ltr">Dear Even Rouault<br><br>I  was also  wondering to know if it is possible to rename the raster bands ?<br><div><br></div><div>Bas</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 17, 2014 at 8:29 PM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nik,<br>
<div class=""><br>
> I have two simple questions (not sure if the answers are as simple)...<br>
><br>
> 1.  Is it possible to rename an OGR layer in place within a writeable data<br>
> store without first creating a copy of the entire layer?<br>
<br>
</div>There's no provision in the OGR API to do that currently. Although it could be<br>
nice to have. That would require of course updating the drivers that would<br>
support that capability, and which are coded currently under the assumption that<br>
the layer name is immutable.<br>
For which driver(s) would you be interested to have that capability ?<br>
<div class=""><br>
><br>
> The only way I've found to do this is to use OGR_DS_CopyLayer() (or similar)<br>
> and then delete the old layer which is fairly expensive as it has to copy all<br>
> of the features as well.<br>
<br>
</div>For drivers that are related to SQL databases, issuing an "ALTER TABLE foo<br>
RENAME TO bar" with ExecuteSQL(), and re-opening the datasource afterwards (OGR<br>
will not notice the change) should do it.<br>
<div class=""><br>
><br>
> 2.  Is it possible to change the order of layers within a writeable OGR data<br>
> store?  (Ie, change the ordering/indexing of layers as they would be<br>
> retrieved with OGR_DS_GetLayer() ).<br>
<br>
</div>That would be much more involved, not to say impossible. For example, for SQL<br>
based drivers, the driver list is issued from a request in system tables or<br>
other tables and there's nothing to control the order of retrieval.<br>
For filebased drivers, such as a directory of shapefiles, it depends on the<br>
order of the operating system in which it return the filenames. Nothing you can<br>
have control on.<br>
To make it possible reliably would probably involve adding a special OGR<br>
metadata table with (order_number, layer_name) columns.<br>
A potential workaround is to use a OGR VRT file as a thin wrapper above your<br>
"real" datasource. The layers will be ordered in the order they are listed in<br>
the VRT.<br>
<br>
Best regards,<br>
<br>
Even<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Geospatial professional services<br>
<a href="http://even.rouault.free.fr/services.html" target="_blank">http://even.rouault.free.fr/services.html</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br></div>