1

I have a table (tbl1) containing POINT geometries in EPSG:27700 (British National Grid).

SELECT id, ST_AsText(geom) as geom FROM tbl1;

=

  id  | geom
------+--------
    1 | POINT(363179.79 176400.12)      
    2 | POINT(333743.58 159668.54)     
    3 | POINT(375287 162596) 
    4 | POINT(340283.42 172058.76)

However I receive an error when I try to transform the CRS to 3857 (or 4326). Example:

SELECT ST_TRANSFORM(geom, 3857) as geom
FROM tbl1;

or

SELECT ST_TRANSFORM(ST_SetSRID(geom, 27700), 3857) as geom
FROM tbl1;

Both result in this error:

ERROR:  could not form projection (PJ) from 'srid=27700' to 'srid=3857'
SQL state: XX000

Additional context:

PostgreSQL version: 13

PostGIS version:

SELECT postgis_full_version();

=

POSTGIS="3.1.1 3.1.1" [EXTENSION] PGSQL="130" GEOS="3.9.1-CAPI-1.14.1" SFCGAL="1.3.8" PROJ="7.1.1" GDAL="GDAL 3.2.1, released 2020/12/29 GDAL_DATA not found" LIBXML="2.9.9" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER

There are other similar questions on GIS SE but none with answers or as detailed as this.

3
  • 2
    I believe the key is in GDAL_DATA not found returned by your query SELECT postgis_full_version();.
    – user30184
    Feb 4, 2022 at 14:27
  • thanks. I have GDAL 3.2.2 installed on my machine however. Perhaps the PostgreSQL installation isn't using it...
    – Theo F
    Feb 4, 2022 at 14:36
  • 2
    I can't say why but GDAL_DATA is not set correctly for your PostGIS.
    – user30184
    Feb 4, 2022 at 14:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.