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

Andre van Atten AvanAtten at reisinformatiegroep.nl
Fri Jun 2 09:47:40 EDT 2006


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:

<OGRVRTDataSource>
        <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>
</OGRVRTDataSource>

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:

  LAYER
    CONNECTION "tb_StationQry.ovf"
    CONNECTIONTYPE OGR
    STATUS ON
    #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 )"
    TYPE POINT
    UNITS METERS
    SIZEUNITS PIXELS
    MAXSCALE 1000000
    TOLERANCE 5
    TOLERANCEUNITS PIXELS
    METADATA
      "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?

Sincerely,

Andre van Atten
GIS Beheerder




More information about the ms4w-users mailing list