0

I have a raster in PostGIS that has a non-standard projection, namely

 select srid,proj4text from spatial_ref_sys where srid=9822;
 srid |                                              proj4text                                              
------+-----------------------------------------------------------------------------------------------------
 9822 | +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
(1 row)

One of these rasters stored is

select ST_Metadata(rast) from wms_current where rid=1 limit 1;
                             st_metadata                             
---------------------------------------------------------------------
 (-2151863.8119731266,2391003.832999289,256,256,300,-300,0,0,9822,1)
(1 row)

ST_Transform produces different results on different systems. The correct version, running PostGIS on MacOS:

select PostGIS_GDAL_Version();
      postgis_gdal_version       
---------------------------------
 GDAL 3.5.3, released 2022/10/21
(1 row)

select ST_Metadata(ST_Transform(rast, 4326)) from wms_current where rid=1 limit 1;
                                             st_metadata                                              
------------------------------------------------------------------------------------------------------
 (-122.4263595659119,41.99724583808909,334,247,0.003420870401971163,-0.003420870401971163,0,0,4326,1)
(1 row)

On Linux:

select PostGIS_GDAL_Version();
      postgis_gdal_version       
---------------------------------
 GDAL 3.5.1, released 2022/06/30
(1 row)

select ST_Metadata(ST_Transform(rast, 4326)) from wms_current where rid=1 limit 1;
                                              st_metadata                                              
-------------------------------------------------------------------------------------------------------
 (-46.507427056342145,42.78351429782924,357,265,0.003601364596063967,-0.003601364596063967,0,0,4326,1)
(1 row)

The versions of PROJ seem to be the same on both systems. Is this a known bug with GDAL 3.5.1?

1 Answer 1

0

I figured this out: the spatial_ref_sys table was different between the two.

What doesn't work:

select * from spatial_ref_sys where srid=9822;
 srid | auth_name | auth_srid | srtext |                                              proj4text                                              
------+-----------+-----------+--------+-----------------------------------------------------------------------------------------------------
 9822 | EPSG      |      9822 |        | +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
(1 row)

What does work:

select * from spatial_ref_sys where srid=9822;
 srid | auth_name | auth_srid | srtext |                                              proj4text                                              
------+-----------+-----------+--------+-----------------------------------------------------------------------------------------------------
 9822 |           |           |        | +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
(1 row)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.