13
Gaia3D 기술세미나 2013. 3. 7

Proj4를 이용한 좌표계 변환

  • Upload
    bj-jang

  • View
    2.600

  • Download
    32

Embed Size (px)

Citation preview

Gaia3D 기술세미나

2013. 3. 7

다양한 좌표계 변환을 제공하는 라이브러리

자유롭게 인자를 지정하여 표준이 아닌 좌표계 간도 변환 가능

USGS의 Gerald Evenden에 의해 만들어진 오픈소스 라이브러리

현재 OSGeo 프로젝트 중 하나이며 MIT 라이센스

GeoServer, OpenLayers, PostGIS, QGIS, GDAL, OGR, GeoTools 등 엄청나게 많은 프로그램에서사용 중

C, C++, JAVA, Javascript 등 다양한 언어로 포팅되어 있음

http://trac.osgeo.org/proj/wiki/GenParms +a Semimajor radius of the ellipsoid axis +alpha ? Used with Oblique Mercator and possibly a few others +axis Axis orientation (new in 4.8.0) +b Semiminor radius of the ellipsoid axis +datum Datum name (see `proj -ld`) +ellps Ellipsoid name (see `proj -le`) +k Scaling factor (old name) +k_0 Scaling factor (new name) +lat_0 Latitude of origin +lat_1 Latitude of first standard parallel +lat_2 Latitude of second standard parallel +lat_ts Latitude of true scale +lon_0 Central meridian +lonc ? Longitude used with Oblique Mercator and possibly a few others +lon_wrap Center longitude to use for wrapping (see below) +nadgrids Filename of NTv2 grid file to use for datum transforms (see below) +no_defs Don't use the /usr/share/proj/proj_def.dat defaults file +over Allow longitude output outside -180 to 180 range, disables wrapping (see below) +pm Alternate prime meridian (typically a city name, see below) +proj Projection name (see `proj -l`) +south Denotes southern hemisphere UTM zone +to_meter Multiplier to convert map units to 1.0m +towgs84 3 or 7 term datum transform parameters (see below) +units meters, US survey feet, etc. +vto_meter vertical conversion to meters. +vunits vertical units. +x_0 False easting +y_0 False northing +zone UTM zone

EPSG:3857, EPSG:900913

+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs

http://spatialreference.org/ref/sr-org/7622/

국토지리정보원 기준 좌표계

+proj=tmerc +lat_0=38 +lon_0=127 +k=1 +x_0=200000 +y_0=600000 +ellps=GRS80 +units=m +no_defs

기상청 한국중심 동아시아 표현에 사용

+proj=lcc +lat_1=30 +lat_2=60 +lat_0=38 +lon_0=126 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs

http://spatialreference.org/ref/epsg/3034/

기상청 북반구 표현에 사용

+proj=stere +lat_0=90 +lon_0=0 +lat_ts=90 +k=0.994+x_0=2000000 +y_0=2000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs

http://spatialreference.org/ref/epsg/32661/

http://osgeo.kr/17

현재 국토지리정보원 표준◦ EPSG:5186◦ +proj=tmerc +lat_0=38 +lon_0=127 +k=1 +x_0=200000 +y_0=600000 +ellps=GRS80

+units=m +no_defs

오래된 지리원 표준 (KLIS사용)◦ EPSG:5174◦ +proj=tmerc +lat_0=38 +lon_0=127.00289 +k=1 +x_0=200000 +y_0=500000 +ellps=bessel

+units=m +no_defs +towgs84=-145.907,505.034,685.756,-1.162,2.347,1.592,6.342◦ [국토지리정보원 고시 제 2006-608호]

http://cafe323.daum.net/_c21_/bbs_search_read?grpid=KSj8&fldid=Lrtt&datanum=758

군사지도 표준◦ EPSG:32652◦ +proj=utm +zone=52 +ellps=WGS84 +datum=WGS84 +units=m +no_defs

새주소지도◦ EPSG:5178◦ +proj=tmerc +lat_0=38 +lon_0=127.5 +k=0.9996 +x_0=1000000 +y_0=2000000 +ellps=bessel

+units=m +no_defs +towgs84=-145.907,505.034,685.756,-1.162,2.347,1.592,6.342

다음지도◦ EPSG:5181◦ +proj=tmerc +lat_0=38 +lon_0=127 +k=1 +x_0=200000 +y_0=500000 +ellps=GRS80

+units=m +no_defs

네이버지도◦ EPSG:5179◦ +proj=tmerc +lat_0=38 +lon_0=127.5 +k=0.9996 +x_0=1000000 +y_0=2000000 +ellps=GRS80

+units=m +no_defs

FWTools (http://fwtools.maptools.org/)

윈도우와 Linux를 위한 오픈소스 GIS 툴 모음

설치가 간편하다!

PROJ.4, GDAL/OGR, Python, OpenEV, MapServer, OGDI를 포함

좌표값, 텍스트파일, 백터데이터, 래스터데이터의 좌표계 변환 가능

cs2cs 이용: PROJ4에서 샘플로 제공하는 커맨드라인 툴

단일 좌표를 커맨드 라인에서 변환◦ cs2cs +proj=tmerc +lat_0=38N +lon_0=128E +ellps=bessel

+x_0=400000 +y_0=600000 +k=0.9999 +towgs84=-146.43,507.89,681.46 +to +proj=latlong +datum=WGS84 +ellps=WGS84 -f %f [Enter] 400196 599694 [Enter]

좌표 리스트 파일 변환◦ cs2cs +proj=tmerc +lat_0=38N +lon_0=128E +ellps=bessel

+x_0=400000 +y_0=600000 +k=0.9999 +towgs84=-146.43,507.89,681.46 +to +proj=latlong +datum=WGS84 +ellps=WGS84 -f %f CoordList.txt

◦ [참고] CootdList.txt에는 x, y 값이 빈칸으로 구분되어 들어 있어야 함

ogr2ogr 이용: GDAL에서 제공하는 벡터 포맷 변환 툴

ogr2ogr -s_srs "+proj=tmerc +lat_0=38 +lon_0=127 +k=1 +x_0=200000 +y_0=600000 +ellps=GRS80 +units=m +no_defs" -t_srs "+proj=utm +zone=52 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" -f "ESRI Shapefile" -skipfailures target.shp source.shp

[참고] 명령 제일 마지막에 대상파일, 원본파일 순으로 기술되어야 함이특이하니 주의!

[Sample] http://www.biz-gis.com/?module=file&act=procFileDownload&file_srl=6394&sid=64bb627c9151c29ffd985e20ed6b9165

ogr2ogr -s_srs "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" -t_srs "+proj=lcc +lat_1=30 +lat_2=60 +lat_0=38 +lon_0=126 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs" -f "ESRI Shapefile" -skipfailuresWorldCountries_LCC.shp WorldCountries.shp

gdalwarp 사용: GDAL에서 제공하는 영상좌표계변환 툴

gdalwarp -s_srs "+proj=tmerc +lat_0=38 +lon_0=127 +k=1 +x_0=200000 +y_0=600000 +ellps=GRS80 +units=m +no_defs" -t_srs "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" -of GTiff -r cubic source.imgtarget.tif

[참고] 인풋, 아웃풋 널 값을 지정할 수 있으니 모자이크가 필요한 영상은 꼭 주의!

[Sample] http://www.samueltoepke.com/projects/olympianengine/public/tutorials/geotiff/files/bluemarble.tif

gdalwarp -s_srs "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" -t_srs "+proj=lcc +lat_1=30 +lat_2=60 +lat_0=38 +lon_0=126 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs" -of GTiff -r cubic bluemarble.tif bluemarble_LCC.tif