[Gdal-dev] OGR and support for older PostGIS DBs?

Markus Neteler neteler at itc.it
Mon Aug 1 13:19:05 EDT 2005


Hi,

I was trying the current OGR (today) against an older
PostGIS database (based on libpostgis.so.0.7 and PostgreSQL V7.3.3):


grinfo -summary PG:'host=myserver user=postgres dbname=spearfish' streams_pg
OGR_PG: DBName="spearfish"
OGR_PG: POSTGIS_VERSION=0.7
OGR_PG: Layer 'streams_geom' geometry type: GEOMETRY:Unknown (any), Dim=2
OGR_PG: Layer 'streams_length_geom' geometry type: GEOMETRY:Unknown (any), Dim=2
OGR_PG: Layer 'areecampione2' geometry type: POLYGON:Polygon, Dim=2
OGR_PG: Layer 'archistes' geometry type: POINT:Point, Dim=2
OGR_PG: Layer 'streams_pg' geometry type: LINESTRING:Line String, Dim=2
OGR_PG: Layer 'mystreams_pg' geometry type: LINESTRING:Line String, Dim=2
OGR: OGROpen(PG:host=myserver user=postgres dbname=spearfish) succeeded (0x837a3f8).
INFO: Open of `PG:host=myserver user=postgres dbname=spearfish'
using driver `PostgreSQL' successful.

Layer name: streams_pg
Geometry: Line String
OGR_PG: PQexec(DECLARE countCursor CURSOR for SELECT count(*) FROM "streams_pg" )

Feature Count: 116
OGR_PG: PQexec(SELECT Extent("wkb_geometry") FROM "streams_pg")
ERROR 5: Bad extent representation: 'BOX3D(589443.06 4913935.46 0,609526.75 4928059.15 0)'
Layer SRS WKT:
PROJCS["UTM Zone 13, Northern Hemisphere",
    GEOGCS["clark66",
        DATUM["North_American_Datum_1927",
            SPHEROID["clark66",6378206.4,294.9786982]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-105],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["meter",1]]
cat: Integer (0.0)
label: String (0.0)


-> Bad extent representation: 'BOX3D.."
-> Integer (0.0)
-> String (0.0)

I am not sure what's wrong... AFAIK I didn't touch the PG DB for a long
while. Is backward compatibility supported? Otherwise I'll have to upgrade
my PG database.

This patch cured at least the BOX3D problem:
--- ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp      20 Jul 2005 01:45:30 -0000      1.29
+++ ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp      1 Aug 2005 17:18:19 -0000
@@ -1282,7 +1282,7 @@
                szVals[strstr(ptr,")") - ptr] = '\0';

                char ** papszTokens = CSLTokenizeString2(szVals," ,",CSLT_HONOURSTRINGS);
-               if ( CSLCount(papszTokens) != 4 )
+               if ( CSLCount(papszTokens) != 6 )
                {
                        CPLError(CE_Failure, CPLE_IllegalArg, "Bad extent representation: '%s'", pszBox);
                        CSLDestroy(papszTokens);


Help is appreciated,

 Markus



More information about the Gdal-dev mailing list