Skip to main content
2 of 3
Thanks for your feedback Paul, I'll do my best to clarify
Ivan
  • 103
  • 6

Issue converting projected coordinates to wgs1984 in Postgis

I'm trying to convert a local PCS (city of Buenos Aires) to wgs1984. Since the PCS is not included in Postgis, I added it to spatial_ref_sys using spatialreference.org (I compared the arguments with a .prj I know is right and they match). My coordinates for the PCS are in WKT, so to make my geometry column in wgs I used:

update <my_table> 
set geom = ST_Transform(ST_SetSRID(ST_GeomFromText(<wkt_column>), <PCS_number>), 4326);

Which works at first glance, but the points are off by approx. 50 meters in relation with my other wgs tables.

When I make the transformation using the Project tool on Arcgis, it works perfect. The difference I see is that Arcgis offers me to use different 'Geographic transformation methods' to make the transformation. The one I choose, and it works fine, is 'Campo_Inchauspe_To_Posgar_2007_1 + Posgar_2007_To_Wgs_1984_1'. I suspect that this method is the key to solve this, but in that case I don't have a clue on how to include that method in the Postgis transformation.

Edit:

My .prj is this:

PROJCS["Argentina_GKBsAs",
GEOGCS["GCS_Campo_Inchauspe",
DATUM["D_Campo_Inchauspe",
SPHEROID["International_1924",6378388.0,297.0]],
PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",100000.0],
PARAMETER["False_Northing",100000.0],
PARAMETER["Central_Meridian",-58.4627],
PARAMETER["Scale_Factor",0.999998],
PARAMETER["Latitude_Of_Origin",-34.6297166],
UNIT["Meter",1.0]]

The projection number in spatialreference.org is 8333, and here you can see it in wkt as html for comparison:

PROJCS["Gauss Krugger BA", GEOGCS["GCS_Campo_Inchauspe", DATUM["D_Campo_Inchauspe", SPHEROID["International_1924",6378388.0,297.0]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]], PROJECTION["Transverse_Mercator"], PARAMETER["False_Easting",100000.0], PARAMETER["False_Northing",100000.0], PARAMETER["Central_Meridian",-58.4627], PARAMETER["Scale_Factor",1.0], PARAMETER["Latitude_Of_Origin",-34.6297166], UNIT["Meter",1.0]]

Here is the Postgis insert statement:

INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 98333, 'sr-org', 8333, '+proj=tmerc +lat_0=-34.6297166 +lon_0=-58.4627 +k=1 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs ', 'PROJCS["Gauss Krugger BA",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388.0,297.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",100000.0],PARAMETER["False_Northing",100000.0],PARAMETER["Central_Meridian",-58.4627],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",-34.6297166],UNIT["Meter",1.0]]');

So, I have one point in wgs:

-58.47532313, -34.63847446

And I make the geometry (Point, 4326) in one table

Then I take the same point in the PCS (8333):

POINT(98897.6171875 98978.84375)

And I make the geometry (Point, 4326) out of the following transformation:

update test_t 
set geom = ST_Transform(ST_SetSRID(ST_GeomFromText(coord), 98333), 4326);

I get this when I pick the point in Qgis:

enter image description here

Being the green point the correct one (the one originally in wgs), and the red the misplaced one (the transformed).

I hope this will clarify the issue, I'll add more data if needed.

Thank you.

Ivan
  • 103
  • 6