ogr/.ovf and mysql

Laura Poggio laura.poggio at GMAIL.COM
Tue Sep 4 12:13:24 EDT 2007


Dear all,
I am starting with mapserver and now I have problems with database issues.
I am using Mysql 5 in windows XP. Mapserver was installed with ms4w 2.2.5.
Normally Mapserver is working fine.
I tried to draw a layer from a mySQL table. The table has spatial
information, i.e. x/y columns.
I tried in two ways first with .ovf file and then with direct ogr
connection. I was unsuccessful in both case.

1) .ovf
MAP FILE for the layer

    LAYER     # point layer with sampled site starts here, query and join
        NAME "dbsites"
        TYPE point
        CONNECTIONTYPE OGR
        CONNECTION "mysql.ovf"
        DATA "aquidata"
        TRANSPARENCY 100
        STATUS on
        HEADER "c:/ms4w/tmp/ms_tmp/appl/q_templates/gru_CGI_db_header.html"
        FOOTER "c:/ms4w/tmp/ms_tmp/appl/q_templates/gru_CGI_db_footer.html"
        TEMPLATE
"c:/ms4w/tmp/ms_tmp/appl/q_templates/gru_CGI_db_class_query.html"
        TOLERANCE 150
        TOLERANCEUNITS pixels
            CLASS
                NAME "dbsites"
                STYLE
                    SYMBOL 'circle'
                    COLOR 0 0 0
                    SIZE 7
                END # end style
            END # end class
    END     # sites layer ends here

.ovf file

<OGRVRTDataSource>
    <OGRVRTLayer name="aqidata">

<SrcDataSource>MYSQL:URBSISdtb_GRU01,user=root,password=leo,host=localhost,port=3306,tables=qloc</SrcDataSource>

        <SrcSQL>SELECT LocCode, X, Y, alt, lu, relief FROM qloc</SrcSQL>
        <GeometryType>wkbPoint</GeometryType>
        <GeometryField encoding="PointFromColumns" x="X" y="Y"/>
    </OGRVRTLayer>
</OGRVRTDataSource>

The ovf file was tested in ogrinfo and everything was fine. When used in the
html template wih CGI substitution strings the following error was reported

msDrawMap(): Image handling error. Failed to draw layer named 'dbsites'.
msOGRFileOpen(): OGR error. GetLayer(aquidata) failed for OGR connection
`mysql.ovf'.


2) direct OGR
    LAYER     # point layer with sampled site starts here, query and join
        NAME "dbsites"
        TYPE point
        CONNECTIONTYPE OGR
        CONNECTION
"MYSQL:URBSISdtb_GRU01,user=root,password=leo,host=localhost,port=3306,tables=qloc"

        DATA "SELECT LocCode, X, Y, alt, lu, relief FROM qloc"
        TRANSPARENCY 100
        STATUS on
        HEADER "c:/ms4w/tmp/ms_tmp/appl/q_templates/gru_CGI_db_header.html"
        FOOTER "c:/ms4w/tmp/ms_tmp/appl/q_templates/gru_CGI_db_footer.html"
        TEMPLATE
"c:/ms4w/tmp/ms_tmp/appl/q_templates/gru_CGI_db_class_query.html"
        TOLERANCE 150
        TOLERANCEUNITS pixels
            CLASS
                NAME "dbsites"
                STYLE
                    SYMBOL 'circle'
                    COLOR 0 0 0
                    SIZE 7
                END # end style
            END # end class
    END     # sites layer ends here

In this case the layer is displayed in the legend, but not draw and no query
are possible.

If someone has any hints on how to solve that.

Thank you very much in advance

Laura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20070904/4d517e99/attachment.html


More information about the mapserver-users mailing list