[Gdal-dev] OGR ODBC Virtual Data Source (VRT) Select with SQL statement

Steve Schnick sschnick at yahoo.com
Fri Jul 23 16:43:35 EDT 2004


Using an .ovf file similar to the one below, I can get the OGR VRT to work, but only if the
OGRVRTLayer name is the same as one of the tables in my database.

<OGRVRTDataSource>
    <OGRVRTLayer name="mylayer">
        <SrcDataSource>ODBC:user/pass at DSN</SrcDataSource> 
 	<SrcLayer>table</SrcLayer> 
	<GeometryType>wkbPoint</GeometryType> 
        <LayerSRS>WGS84</LayerSRS>
	<GeometryField encoding="PointFromColumns" x="x" y="y"/> 
    </OGRVRTLayer>
</OGRVRTDataSource>

If I try the .ovf below, it will work but, like before, only if the name of the layer is the same
as a table. However, it appears that the SrcSQL statement is not being applied because I always
get all of the features in the layer. Even if I enter garbage text in the SQL, it still returns
all records.

<OGRVRTDataSource>
    <OGRVRTLayer name="mylayer">
        <SrcDataSource>ODBC:user/pass at DSN</SrcDataSource> 
 	<SrcSQL>SELECT * FROM table WHERE time LIKE SUBSTR("%time%", 0, 4)</SrcSQL> 
	<GeometryType>wkbPoint</GeometryType> 
        <LayerSRS>WGS84</LayerSRS>
	<GeometryField encoding="PointFromColumns" x="x" y="y"/> 
    </OGRVRTLayer>
</OGRVRTDataSource>

Can anyone shed some light on this for me?

Thanks.

Steve


	
		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/



More information about the Gdal-dev mailing list