odbc OGRVRTDataSource does not work in layerdefinition as of gdal 1.3.2

Huub Fleuren hfl at HOME.NL
Sun May 14 16:30:46 EDT 2006


Hi List,

I have the following OVF file which defines an ODBC (msaccess) 
OGRVRTDataSource.
I'm testing this with gdal 1.3.2

<OGRVRTDataSource>
        <OGRVRTLayer name='kpxy'>
            <SrcDataSource>ODBC:admin/admin at anwb</SrcDataSource>
    <SrcSQL>SELECT k.kp_nr as kp_nr,k.x as x, k.y as y, w.wcode as 
wcode, w.ocode as ocode FROM wwall w, kpxy k WHERE NOT (k.soort LIKE 
'D') and (w.x &gt; 190000) and (w.x &lt; 200000) and (w.y &gt; 500000) 
and (w.y &lt; 520000) and (w.nummer = k.kp_nr)</SrcSQL>
            <GeometryType>wkbPoint</GeometryType>
            <LayerSRS>WGS84</LayerSRS>
            <GeometryField encoding='PointFromColumns' x='x' y='y'/>
        </OGRVRTLayer>
    </OGRVRTDataSource>


ogrinfo test.ovf -sql "select count(*) from  kpxy"
ERROR 4: Update access not supported for VRT datasources.
Had to open data source read-only.
INFO: Open of `test.ovf'
using driver `VRT' successful.
Layer name: kpxytest
Geometry: Point
Feature Count: 1
Layer SRS WKT:
(unknown)
count_*: Integer (0.0)
OGRFeature(kpxytest):0
  count_* (Integer) = 375

I copied the test.ovf into the layer definition. (see complete layerdef 
further)
To my surprise there are no points selected.

I ( sometimes ) get the following error

====

<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE ServiceExceptionReport SYSTEM 
"http://schemas.opengeospatial.net/wms/1.1.0/exception_1_1_0.dtd">
<ServiceExceptionReport version="1.1.0">
<ServiceException>
msDrawMap(): Image handling error. Failed to draw layer named 
&#39;kpxytest&#39;.
msOGRFileOpen(): OGR error. Open failed for OGR connection 
`&lt;OGRVRTDataSource&gt;
        &lt;OGRVRTLayer name=&#39;kpxytest&#39;&gt;
            &lt;SrcDataSource&gt;ODBC:admin/admin at anwb&lt;/SrcDataSource&gt;
    &lt;SrcSQL&gt;SELECT k.kp_nr as kp_nr&#39;.
Parse error at EOF, not all elements have been closed,
starting with SrcSQL


</ServiceException>
</ServiceExceptionReport>
msOGRFileOpen(<OGRVRTDataSource>
        <OGRVRTLayer name='kpxy'>
            <SrcDataSource>ODBC:admin/admin at anwb</SrcDataSource>
    <SrcSQL>SELECT k.kp_nr as kp_nr,k.x as x, k.y as y, w.wcode as 
wcode, w.ocode as ocode FROM wwall w, kpxy k WHERE NOT (k.soort LIKE 
'D') and (w.x &gt; 190000) and (w.x &lt; 200000) and (w.y &gt; 500000) 
and (w.y &lt; 520000) and (w.kruispunt = k.kp_nr)</SrcSQL>
            <GeometryType>wkbPoint</GeometryType>
            <LayerSRS>WGS84</LayerSRS>
            <GeometryField encoding='PointFromColumns' x='x' y='y'/>
        </OGRVRTLayer>
    </OGRVRTDataSource>)...
OGROPen(<OGRVRTDataSource>
        <OGRVRTLayer name='kpxy'>
            <SrcDataSource>ODBC:admin/admin at anwb</SrcDataSource>
    <SrcSQL>SELECT k.kp_nr as kp_nr)


====

LAYERDEF

The complete LAYER definiton looks like this
  LAYER
    debug on

    NAME kpxytest
    TYPE POINT
    CONNECTIONTYPE OGR
    #CONNECTION "c:/inetpub/wwwroot/cgi-bin/mapserv40/virtual.ovf" # the 
name and path to the virtual.ovf file, relative to shapepath may work?

    # zie ook: 
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?VirtualSpatialData
    #          http://www.remotesensing.org/gdal/ogr/ogr_sql.html
    #
    CONNECTION "<OGRVRTDataSource>
        <OGRVRTLayer name='kpxytest'>
            <SrcDataSource>ODBC:admin/admin at anwb</SrcDataSource>
    <SrcSQL>SELECT k.kp_nr as kp_nr,k.x as x, k.y as y, w.wcode as 
wcode, w.ocode as ocode FROM wwall w, kpxy k WHERE NOT (k.soort LIKE 
'D') and (w.x &gt; 190000) and (w.x &lt; 200000) and (w.y &gt; 500000) 
and (w.y &lt; 520000) and (w.nummer = k.kp_nr)</SrcSQL>
            <GeometryType>wkbPoint</GeometryType>
            <LayerSRS>WGS84</LayerSRS>
            <GeometryField encoding='PointFromColumns' x='x' y='y'/>
        </OGRVRTLayer>
    </OGRVRTDataSource>"
    LABELITEM "kp_nr"
    STATUS ON
    DUMP false
    MINSCALE 0
    MAXSCALE 150000
    CLASS
      NAME 'kpxy'
      STYLE
        COLOR 0 0 255
        SYMBOL 'circle'
        OUTLINECOLOR 0 0 0
        SIZE 7
      END
      LABEL
        COLOR 132 31 31
        SHADOWCOLOR 255 255 255
        SHADOWSIZE 2 2
        TYPE TRUETYPE
        FONT arial-bold
        SIZE 8
        ANTIALIAS TRUE
        POSITION CR
        # POSITION AUTO
        PARTIALS FALSE
        MINDISTANCE 10
        BUFFER 1
      END # end of label
    END
    METADATA
      WMS_TITLE "Virtual kruispunten"
      WMS_ABSTRACT "Virtual xy ovf layer."
      WMS_SRS "EPSG:28992"
    END
  END


How can it be explained?. Can i get it to work? Is this a bug?

Regards, Huub (excuse for the fuss in the previous thread)



More information about the mapserver-users mailing list