[GIS] Convert from EPSG:4326 to UTM in PostGIS

convertpostgisutm

I would like to convert from EPSG:4326 to UTM (30N/EPSG:32630 or 29N/EPSG:32629) in PostGIS. I do the following query but I get wrong results:

SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(36.5277099609375 -5.86424016952515)',4326),32630)) As check;

I get "POINT(5262418.33128724 -839958.963432011)" when it should be something approximate to 243625.00,4046330.00 in UTM 30N. If I do the conversion from 4326 to UTM I get the right result but not from UTM to 4326.

  • What's wrong with the query?
  • And are there anyway to get the UTM timezone from the coordinates in
    EPSG:4326 because I don't know if they belong to 30N or 29N?

Best Answer

There is something wrong with your data. POINT(36.5277099609375 -5.86424016952515) is on the southern Hemisphere at 36°E and 5° South.

I guess you rather want POINT(-5.86424016952515 36.5277099609375) which is close to the border of 29N and 30N.

The borders between the UTM zones are 6 degrees apart, starting from -180° in the West. But there are some exceptions around Norway.

Related Question