[gdal-dev] OGR2OGR - Define output naming from concatenated queries from a DB

abhay menon abhay.menon at gmail.com
Thu Aug 7 05:30:36 EDT 2008


On Thu, Aug 7, 2008 at 12:23 PM, D <eloquence2 at gmail.com> wrote:

>  Hi,
>
> I have a question about the usage of OGR2OGR in defining an ESRI Shapefile
> output name. I am exporting Spatial data from Oracle Spatial (11g) from a
> single table to an ESRI Shapefile and would like to get the following naming
> syntax for my Shapefile:
>
>
> [select distinct FIELD1 from SHEMA.TABLE][select distinct FIELD2 from
> SHEMA.TABLE][fixed value -> 01]
>
> .. the output would look like
>
> 50000002806200701.shp
> 50000002806200701.shx
> 50000002806200701.dbf
>
> The naming parts/chunks that are concatenated here are actually queries in
> the source database (Oracle).
>
> Any examples (sample scripts, procedures) or hints on how to implement
> this, would be very helpful.
>
> Thanks!
>
> Best regards,
> Dejan
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>

Hi Dejan,

I don't think it is possible using ogr2ogr.exe, you will need to write a
small programme to do so.

Sorry I have not written any script yet on such a issue. But you could what
you could do is.

Open a recordset and from the desired name in select statement

select [select distinct FIELD1 from SHEMA.TABLE] || [select distinct FIELD2
from SHEMA.TABLE] || 01 from DUAL

and then pass this into the command line parameter as string

to from

ogr2ogr.exe -f "ESRI Shapefile" <string from database result>.shp
"OCI:xxxxxxx/xxxxxxx at dbname" -sql <select queries that you want the output
from >

and execute this thru shell or command prompt.

Hope this helps...!!!

Rgds.
Abhay.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080807/94f97452/attachment-0001.html


More information about the gdal-dev mailing list