[gdal-dev] OGR PG Driver 1.8 to 1.9 undocumented functionality change (bug?) with ExecuteSQL/GetSpatialRef

Silas Parker skyhisi at gmail.com
Fri Dec 16 06:21:01 EST 2011


Hello,

I've found that the behaviour of the PG (Postgres/Postgis) driver has
changed between 1.8 and 1.9 in ExecuteSQL that isn't listed in the
NEWS file.

The Spatial reference system of a SQL query can not be obtained (using
GetSpatialRef) if the SQL query starts with white-space.

This may be a bug, or an undocumented change in functionality!

I am testing with trunk SVN rev 23573, on Ubuntu 10.04.

The problem can be reproduced using ogrinfo, although I first observed
this in a different application.

In version 1.8.0:

$ ogrinfo --version
GDAL 1.8.0, released 2011/01/12

$ ogrinfo -ro -so -sql " SELECT * FROM codepoint" "PG:dbname=geocoder
user=postgres password=postgres"
INFO: Open of `PG:dbname=geocoder user=postgres password=postgres'
      using driver `PostgreSQL' successful.

Layer name: sql_statement
Geometry: Unknown (any)
Feature Count: 1689582
Extent: (63215.000000, 8195.000000) - (655448.000000, 1213660.000000)
Layer SRS WKT:
PROJCS["OSGB 1936 / British National Grid",
    GEOGCS["OSGB 1936",
        DATUM["OSGB_1936",
            SPHEROID["Airy 1830",6377563.396,299.3249646,
                AUTHORITY["EPSG","7001"]],
            AUTHORITY["EPSG","6277"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.01745329251994328,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4277"]],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",49],
    PARAMETER["central_meridian",-2],
    PARAMETER["scale_factor",0.9996012717],
    PARAMETER["false_easting",400000],
    PARAMETER["false_northing",-100000],
    AUTHORITY["EPSG","27700"],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH]]
FID Column = ogc_fid
Geometry Column = wkb_geometry
postcode: String (0.0)
countryc: String (0.0)
countyc: String (0.0)
districtc: String (0.0)
wardc: String (0.0)
nhsregionc: String (0.0)
nhsareac: String (0.0)
countrys: String (0.0)
countys: String (0.0)
districts: String (0.0)
wards: String (0.0)
nhsregions: String (0.0)
nhsareas: String (0.0)


In version 1.9:

$ ogrinfo --version
GDAL 1.9dev, released 2011/01/18

$ ogrinfo -ro -so -sql " SELECT * FROM codepoint" "PG:dbname=geocoder
user=postgres password=postgres"
INFO: Open of `PG:dbname=geocoder user=postgres password=postgres'
      using driver `PostgreSQL' successful.

Layer name: sql_statement
Geometry: Unknown (any)
Feature Count: 1689582
Extent: (63215.000000, 8195.000000) - (655448.000000, 1213660.000000)
Layer SRS WKT:
(unknown)
postcode: String (0.0)
countryc: String (0.0)
countyc: String (0.0)
districtc: String (0.0)
wardc: String (0.0)
nhsregionc: String (0.0)
nhsareac: String (0.0)
countrys: String (0.0)
countys: String (0.0)
districts: String (0.0)
wards: String (0.0)
nhsregions: String (0.0)
nhsareas: String (0.0)

Thanks,

Silas


More information about the gdal-dev mailing list