ogrinfo show x y columns as strings

Frank Warmerdam fwarmerdam at GMAIL.COM
Fri May 6 09:56:22 EDT 2005


On 5/6/05, Richard Duivenvoorde <rdmailings at duif.net> wrote:
> But putting everything to linux fails, because ogr(info) (with exactly
> the same txt file) reports the x y columns as strings, giving a
> featurecount of zero => no features on the map :-(
> 
> ogrinfo -ro -al ODBC:@puntenlaagdsn testpoints.txt
> INFO: Open of `ODBC:@puntenlaagdsn'
> using driver `ODBC' successful.
> 
> Layer name: testpoints.txt
> Geometry: Unknown (any)
> Feature Count: 0
> Layer SRS WKT:
> (unknown)
> text: String (255.0)
> x: String (255.0)
> y: String (255.0)
> 
> Does anybody knows what's the problem?
> 
> Is it an odbc problem?

Richard, 

I believe this is a flaw with the text file ODBC driver on 
that comes with unixODBC.  We had a number of problems with
it on AIX a couple of years ago and came to the conclusion it
was not very trustworthy.

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.  

> Who is responsible for 'typing' the columns in the txt file?

The ODBC driver pretty much has to guess in the CSV case
since there is no type information in the file. 

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).
INFO: Open of `text.csv'
using driver `CSV' successful.

Layer name: text
Geometry: None
Feature Count: 2
Layer SRS WKT:
(unknown)
text: String (0.0)
x: String (0.0)
y: String (0.0)
OGRFeature(text):1
  text (String) = test
  x (String) = 10
  y (String) = 10

OGRFeature(text):2
  text (String) = test2
  x (String) = 11
  y (String) = 11

The values do some through as strings, but I don't think that
really matters for most purposes. 

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list