Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#3197 closed defect (invalid)

convert mysqldata to KML problems with comparison operator

Reported by: klinsoft Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: vrt xml
Cc:

Description (last modified by warmerdam)

Trying to convert Mysql data to KML i'm using ogr2ogr -f "KML" test.kml test.ovf

test.ovf is:

jerry:/srv/www/htdocs/mapping/maps/mysql # more AirportKLM.ovf
<OGRVRTDataSource>
        <OGRVRTLayer name="Airports">
        <SrcDataSource>MYSQL:gribDB,user=kling,password=Welcome,host=127.0.0.1,port=3306,tables=stations</SrcDataSource>
        <SrcSQL>SELECT icao,name,wmo,land,lat,lon FROM stations WHERE (KLM = TRUE) AND (lon > 60.0 )</SrcSQL>
        <GeometryType>wkbPoint</GeometryType>
        <GeometryField encoding="PointFromColumns" x="lon" y="lat"/>
        </OGRVRTLayer>
</OGRVRTDataSource>

in the SQL part if I do ( lon > 60.0 ) it is working, but when I use ( lon < 60.0 ) I'm getting

ERROR 1: Line 3: Didn't find expected '=' for value of attribute ')'.

What is going wrong???

Thanks

Regards Kees Kling

Change History (2)

comment:1 by warmerdam, 15 years ago

Component: defaultOGR_SF
Description: modified (diff)
Keywords: vrt xml added
Resolution: invalid
Status: newclosed

Kees,

the problem is that the contents of the <SrcSQL> tag need to use XML escape sequences for special characters, like > that can be interpreted as part of a tag or other XML component. Try converting the > to &gt; and < to &lt;

in reply to:  description comment:2 by klinsoft, 15 years ago

Replying to klinsoft:

Trying to convert Mysql data to KML i'm using ogr2ogr -f "KML" test.kml test.ovf

test.ovf is:

jerry:/srv/www/htdocs/mapping/maps/mysql # more AirportKLM.ovf
<OGRVRTDataSource>
        <OGRVRTLayer name="Airports">
        <SrcDataSource>MYSQL:gribDB,user=kling,password=Welcome,host=127.0.0.1,port=3306,tables=stations</SrcDataSource>
        <SrcSQL>SELECT icao,name,wmo,land,lat,lon FROM stations WHERE (KLM = TRUE) AND (lon > 60.0 )</SrcSQL>
        <GeometryType>wkbPoint</GeometryType>
        <GeometryField encoding="PointFromColumns" x="lon" y="lat"/>
        </OGRVRTLayer>
</OGRVRTDataSource>

in the SQL part if I do ( lon > 60.0 ) it is working, but when I use ( lon < 60.0 ) I'm getting

ERROR 1: Line 3: Didn't find expected '=' for value of attribute ')'.

What is going wrong???

Thanks

Regards Kees Kling

Great, it is working. Thanks for your fast reply

Kees Kling

Note: See TracTickets for help on using tickets.