datum transformation produces unexpected results

Viewed 31

I am new to postgis, so please excuse what may be a very misguided question. I'm trying to reproject coordinates into a standard datum, but in some cases I don't think I'm getting a realistic result. The most obvious is from https://epsg.io/4813 to https://epsg.io/4326.

select version();
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 12.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit

select postgis_version();
            postgis_version            
---------------------------------------
 3.0 USE_GEOS=1 USE_PROJ=1 USE_STATS=1

select ST_AsText(ST_Transform(ST_SetSrid(ST_MakePoint(107.8, -6.23), 4813), 4326)) as transformed_point_text;
           transformed_point_text           
--------------------------------------------
 POINT(-145.399281070071 -6.23065386582626)

-145.399281070071 longitude is of course nowhere near Java, the source of the original coordinates.

1 Answers

Are you sure the original coordinates are correct? The longitute 107.8 seems to lie outside of the Jawa bounding box (according to the SRS). I tried to reproduce the error with the following coordinates: lon 4.4169, lat -7.5152 and it looks just fine:

SELECT 
  ST_AsText(
        ST_Transform(
          ST_SetSrid(ST_MakePoint(4.4169, -7.5152), 4813), 
          4326)) AS transformed_point_text;

            transformed_point_text            
----------------------------------------------
 POINT(111.22556977613065 -7.514891511989998)

enter image description here

The coordinates you provided are most likely already in WGS84 (not in EPSG:4813), and therefore do not need to be transformed:

SELECT ST_SetSrid(ST_MakePoint(107.8, -6.23),4326);

enter image description here

Related