[ms4w-users] OGR VRT datasource with SrcSQL clause resulting in empty layer

Bart van den Eijnden (OSGIS) bartvde at xs4all.nl
Fri Jun 2 10:20:15 EDT 2006

Hi Andre,

all I can say is I have experienced similar problems, also with Oracle, 
and always use views whenever possible.

You say views are not visible to OGR, have you tried to use the 
following explicit syntax:


/*As a side note, your question is more appropriate for the 
mapserver-users list:


This list is intended only for issues about the MS4W installer itself, 
not Mapserver in general.

Best regards,

Andre van Atten wrote:

>Hi list,
>I use MS4W 4.8.3 (using php_mapscript_48.dll ) on Windows200SP4 with Apache and OGR, and experimenting with virtual Spatial data (point layers on X,Y pairs in a SQL server 2000 database) I am confronted with the following problem:
>If I use the SrcSQL option in a .OVF file and if I test it with OGRINFO a get a nice result with about 500 points. As soon as I use the layer in a mapfile this results in an empty layer: No error is reported, but no symbols are shown and no points are selectable.
>I use the following OVF syntax:
>        <OGRVRTLayer name="tb_StationDB">
>        <SrcDataSource>ODBC:@datasourcename</SrcDataSource>
>        <SrcSQL>SELECT * FROM tb_Station WHERE CompanyNo = 1</SrcSQL>
>        <GeometryField encoding="PointFromColumns" x="X" y="Y"/>
>        <FID>StationId</FID>
>        <GeometryType>wkbPoint</GeometryType>
>        </OGRVRTLayer>
>As soon as I use the SrcLayer option instead (on the entire table) there are no problems and all points are shown
>I use the same layer syntax on both options, so that should not be the problem:
>    CONNECTION "tb_StationQry.ovf"
>    #DATA "SELECT * FROM tb_StationDB WHERE CompanyNo=1" #werkt niet: wel symbolen op de kaart maar info laat php crashen
>    DATA "tb_StationDB"
>    NAME "Stations_Prod"
>    #bij selectie op database velden wordt FILTER clausule niet meegenomen 
>    #FILTER "WHERE NOT (ClusterNo IS NULL )"
>    MAXSCALE 1000000
>      "DESCRIPTION"    "Geclusterde Stations Productie"
>    END
>    CLASS
>      NAME "tb_StationDB"
>      TEMPLATE "tb_StationDB.html"
>      STYLE
>        SYMBOL 'default-marker'
>        COLOR 0 0 255
>        SIZE 10
>        MINSIZE 1
>        MAXSIZE 100
>      END
>    END
>  END
>*I cannot use views in the database, they are not "visible" to OGRINFO
>*The layer DATA option used on the ScrLayer plots the right symbols but causes php-crashes on querying the map
>*The layer FILTER option on the ScrLayer works well on plotting the symbols on the map and querying them on the map. However: searching on the layer returns all records without concerning the FILTER option in the LAYER definition.
>Is this a bug or does anyone has a bright idea?
>Andre van Atten
>GIS Beheerder
>ms4w-users mailing list
>ms4w-users at lists.maptools.org

Bart van den Eijnden
OSGIS, Open Source GIS

More information about the ms4w-users mailing list