1

I set a field with

UPDATE members SET latlong_degree = ST_AsLatLonText (the_geom)

But the result is (for example)

48°37’41.742”N 9°17’55.716”E

The seconds part is way too precise, what I want is

48°37’42”N 9°17’56”E

So I want to round the output…

Do you know a PostGIS command or other method to wrap the statement in, to accomplish this?

6

The documentation for ST_AsLatLonText explains that you can use an optional second argument to specify the format.

In your case, it would be:

UPDATE members SET latlong_degree = ST_AsLatLonText (the_geom, 'D°M''S"C')

Note that the ' mark for the minutes has to be double quoted to avoid it just terminating the string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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