[gdal-dev] OGR is not able to determine PostGIS table SRS

Sorokine, Alexandre sorokina at ornl.gov
Wed Jul 8 16:13:55 EDT 2009


Rouault,

Yes, that was the problem.  spatial_ref_sys in my database got damaged somehow.  I have rebuilt it and now all seems to work right, the problem is resolved.

Thank you fro your help!

On 7/8/09 3:07 PM, "Even Rouault" <even.rouault at mines-paris.org> wrote:

Alexandre,

the interesting trace I noted in the gdal-debug.txt file is :

PG: PQexec(SELECT srtext FROM spatial_ref_sys WHERE srid = 4326) =
PGRES_TUPLES_OK, ntuples = 0

It looks like your spatial_ref_sys table is not correctly filled. You should
check its content and/or its permissions.

Best regards,
Even

Le Wednesday 08 July 2009 18:24:36 Sorokine, Alexandre, vous avez écrit :
> Frank,
>
> > Actually, I suspect the debug facilities in trunk for the OGR PG driver
> > have been upgraded.  Would it be practical for you to try things with
> > trunk?
>
> I did some more debugging with the version from the trunk checked out
> around 10AM EST today.  I compiled it on OSX with macports as:
>
> /configure --prefix=/Users/sorokine/Documents/appl/gdalsvninst
> --with-pg=/opt/local/lib/postgresql83/bin/pg_config
> --with-netcdf=/opt/local --enable-debug && make -j7 && make install
>
> Results of running ogrinfo are in the file in the attachment (ogrinfo with
> debug plus postgresql staements from logs).  My observations is that trunk
> version solves some of the problems but other problems persist:
>
> 1.  Trunk version (compared to 1.6.0)  properly sets SRID for the WHERE
> clause with the bounding box:
>
> PG: OGRPGTableLayer::BuildWhere returns: WHERE "the_geom" &&
> SetSRID('BOX3D(-178.217606000000 18.921785000000, -66.969269000000
> 71.406242000000)'::box3d,4326)
>
> Compare to 1.6.0:
>
> PG: OGRPGTableLayer::BuildWhere returns: WHERE the_geom &&
> SetSRID('BOX3D(-178.217606000000 18.921785000000, -66.969269000000
> 71.406242000000)'::box3d,-1)
>
> 2.  Trunk version does NOT fix reporting of SRS through
> OGR_L_GetSpatialRef(layer) or OGR_F_GetSpatialReferemce(feature), both
> return NULL.  I've tested it in my code and you can see that in trunk
> ogrinfo output:
>
> Layer SRS WKT:
> (unknown)
>
> 3.  Trunk version doe not properly set bounding box SRS through
> OGR_L_SetSpatialFilterRect() function.  I've tested it in my code.
> Bounding box works in ogrinfo but ogrinfo does not use this function (it
> builds a geometry).
>
> I hope we will be able to fix it,
>
> On 7/7/09 11:10 PM, "Frank Warmerdam" <warmerdam at pobox.com> wrote:
> > Sorokine, Alexandre wrote:
> >> Franks,
> >>
> >> Thank you for your reply, I did some more checks.  Please see my
> >> comments below.
> >
> > Alexandre,
> >
> > I'm still wondering if this is related to schemas.  I was surprised to
> > not see any queries against the spatial_ref_sys table.  In my trunk build
> > I see something like:
> >
> > PG: PQexec(SELECT srtext FROM spatial_ref_sys WHERE srid = 4326) =
> > PGRES_TUPLES_OK, ntuples = 1
> >
> >
> > 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 gdal-dev mailing list