ogrinfo show x y columns as strings

Richard Duivenvoorde rdmailings at DUIF.NET
Fri May 6 08:33:34 PDT 2005


Frank Warmerdam wrote:

> You might want to try doing dos to unix text conversion on the
> file, to see if that is at the root of the problem.

I tried some fiddling with linefeeds, but did'nt succeed. A textfile
(either csv or txt extension) fails to work as a virtual datasource with me.

>
> BTW, another alternative with modern GDAL/OGR's is to use
> the CSV driver.  Rename your file testpoints.csv and it should
> work.
>
>  warmerda at gdal2200[23]% cat text.csv
> text,x,y
> test,10,10
> test2,11,11
> warmerda at gdal2200[24]% ogrinfo -ro -al text.csv
> OGR: OGROpen(text.csv) succeeded (0x80c05a8).

Yep, you are right. OgrInfo (using driver CSV) sees features now, but
only when reading it straigt from disk. If I feed it to ogr via a odbc
connection (needed for virtual datascources (isn't it???)). It still
says 0 features, because it uses the VRT driver.

ogrinfo puntenlaag.ovf punten
ERROR 4: Update access not supported for VRT datasources.
Had to open data source read-only.
INFO: Open of `puntenlaag.ovf'
using driver `VRT' successful.
Layer name: punten
Geometry: Point
Feature Count: 0
Layer SRS WKT:

or

ogrinfo ODBC:puntenlaagdsn testpoints.csv
INFO: Open of `ODBC:puntenlaagdsn'
using driver `ODBC' successful.
Layer name: testpoints.csv
Geometry: Unknown (any)
Feature Count: 0
Layer SRS WKT:


Q1: Can I force it(ogr/mapserver) to use the CSV driver?

Q2: is there another way/workaround to use textbased files as
datasources (on *ix)?


To give some context: I want to build a testing webapp where
(web)clients can add some points. The points are (sessionbased) put in
there own txtfile. So they would see only there own points. It would be
easy for me to just delete all textfiles after one or two day.
I can off course do it using mysql or another database, but thought txt
based would be easy and sufficient.

TIA

Richard



More information about the MapServer-users mailing list