# Geographic coordinate system#Find similar titles

A geographic coordinate system (지리 좌표계) is a coordinate system that enables every location on Earth to be specified by a set of numbers, letters or symbols. (https://en.wikipedia.org/wiki/Geographic_coordinate_system)

GPS 정보를 활용하거나 GIS를 구축하려면 잘 알아야 함.

좌표의 종류

• DMS (Degrees, minutes, seconds): 36°57'9" N
• DD (Decimal degrees): 38.203655

DD의 소수점 8자리는 적도에서 1.1132 mm에 해당함 (WikiPedia:Decimal_degree)

좌표 변환 코드 (이 코드를 좀 변경함)

``````#!python
import re

def dms2dd(degrees, minutes, seconds, direction):
dd = float(degrees) + float(minutes)/60 + float(seconds)/(60*60);
if direction == 'S' or direction == 'W':
dd *= -1
return dd;

def dd2dms(deg):
d = int(deg)
md = abs(deg - d) * 60
m = int(md)
sd = (md - m) * 60
return [d, m, sd]

def parse_dms(dms):
parts = re.split('[^\d\w^\.]+', dms)
lat = dms2dd(parts[0], parts[1], parts[2], parts[3])
lng = dms2dd(parts[4], parts[5], parts[6], parts[7])

return (lat, lng)

dd = parse_dms("36°57'9' N 110°4'21' W")

print(dd)
print(dd2dms(dd[0]))

# (36.9525, -110.07249999999999)
# [36, 57, 9.000000000002046]
``````
web biohackers.net
0.0.1_20140628_0
• python