Just copy the code below into your MapBasic window and modify the sections highlighted to create a query table with columns displaying DMS. Feel free to add as many columns separating with a comma (,).
SELECT
Col1,
Col2,
Fix(CentroidY(obj)) & "°" &
Fix((Abs(CentroidY(obj)) - Abs(Fix(CentroidY(obj))))*60) & "'" &
Round(((((Abs(CentroidY(obj)) - Abs(Fix(CentroidY(obj))))*60) - Fix((Abs(CentroidY(obj)) - Abs(Fix(CentroidY(obj))))*60)) * 60),0.01) & Chr$(34) "Latitude_DMS",
Fix(CentroidX(obj)) & "°" &
Fix((CentroidX(obj) - Fix(CentroidX(obj)))*60) & "'" &
Round(((((CentroidX(obj) - Fix(CentroidX(obj)))*60) - Fix((CentroidX(obj) - Fix(CentroidX(obj)))*60))*60),0.01) & Chr$(34) "Longitude_DMS"
FROM Table_Name
INTO Result_Table_Name
BROWSE * FROM Result_Table_Name
COL1 | COL2 | Latitude_DMS | Longitude_DMS |
Value 1 | 1 | -26°27'52.4" | 149°0'15.54" |
Value 2 | 2 | -26°28'3.66" | 148°59'47.76" |
Value 3 | 3 | -26°28'2.72" | 148°59'51.7" |
Value 4 | 4 | -26°28'10.89" | 148°59'47.51" |
Value 5 | 5 | -26°30'29.1" | 148°58'55.66" |
Very nice, James.
ReplyDeleteI'm sure I would have missed some brackets in my first shot at this ;-)