I have a PostgreSQL/PostGIS database with a two string fields containing Lat and Long coordinates in degrees and decimal minutes, like this 45° 24.5' N
3° 43.01' E
.
How can I convert them into decimal degrees, for use in ST_GeographyFromText
?
I have a PostgreSQL/PostGIS database with a two string fields containing Lat and Long coordinates in degrees and decimal minutes, like this 45° 24.5' N
3° 43.01' E
.
How can I convert them into decimal degrees, for use in ST_GeographyFromText
?
You may try this:
EDIT
Presuming this is your PostGIS table,
running the DMS2DD function gives this:
EDIT 2
Because you have only Degrees and Minutes
,
in the DMS2DD function you need to comment one single line to achieve your results:
Degrees and Minutes
.
Commented
Jan 29, 2014 at 12:11
In my opinion there exists no function that is the inverse of ST_AsLatLongText, but it is well discussed. It would be a very useful function.
For your business:
When you are familiar with R than you can use this function, which converts your coordinates from degrees to decimals.
After that you update your table with the new coordinates (best way would be a postgresql/postgis connection with R, see RPostgreSQL and DBI). And then you can use the ST_GeographyFromText function.