[gdal-dev] ogr2ogr problem
pcreso at pcreso.com
pcreso at pcreso.com
Tue Jan 6 16:09:55 EST 2009
Hi,
My apologies for introducing problems from an old version, but it is what is installed & I can't have it changed for weeks at least....
The problem is with ogr2ogr in version 1.3.1 of GDAL under FreeBSD.
I need to generate GMT files for an online mapping application generating publication ready maps from data held in a Postgis database. This version of ogr predates GMT support. I figured therefore that the simple needs of this application could be met by generating Mapinfo MID/MIF files with ogr2ogr instead, and then conver these to GMT, which is pretty simple in this instance.
My problem now is that the coordinate list in my MIF file bears no resemblance to the data in the database.
Sample data is:
db_trawl=# select station_no, astext(trackline) from station;
station_no | astext
------------+-----------------------------------------------------
16 | LINESTRING(174.37767 -73.0465,174.358 -73.0535)
32 | LINESTRING(170.1775 -74.5895,168.96917 -74.64633)
37 | LINESTRING(166.98883 -74.746,166.99367 -74.74633)
41 | LINESTRING(167.01317 -74.72617,167.025 -74.7105)
73 | LINESTRING(170.33333 -76.59233,176.4625 -76.18183)
84 | LINESTRING(176.802 -76.60233,176.79417 -76.60217)
An example ogr2ogr command is:
ogr2ogr -f "Mapinfo File" -dsco "FORMAT=MIF" -nln sql ttt 'PG:host=wms dbname=db_trawl user=woodb' -sql "select station_no, trackline from station"
The MIF file looks like:
more ./ttt/sql.mif
Version 300
Charset "Neutral"
Delimiter ","
Columns 1
station_no Integer
Data
Pline 4326
-3.491895524626381e+151 -1.043410953990767e+131
-1.149081422917241e-17 -2.086868818946656e-254
1.594160455862601e-314 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
....
The trackline colummn comprises linestrings with only start & end points, not the thousands of vertices ogr2ogr outputs, and the values of the coordinates are also nowhere near the correct ones.
So, some questions, can anyone suggest a way forward here? Is the problem known, & if so, is it with the Postgres driver retrieving bad data, or the Mapinfo driver writing bad data?
(short of the obvious upgrade GDAL - I prototyped on v1.5.1 under Linux & all this works perfectly, both the GMT write & the MID/MIF workaround)
Thanks,
Brent Wood
More information about the gdal-dev
mailing list