2D Map Service, How to? 2008 년 8월 22 일
주요내용 순서 Ⅰ. Google Mercator Ⅱ. Google Maps, How to?? Ⅲ. Mapnik Ⅳ. OpenLayers Ⅴ. Demo Ⅴ. 질의및응답
1. Google Mercator??? Why? 왜 Google Mercator 라고부르게됐는가? 왜 Mercator 인가? Who? 누가 Google Mercator 를이용하여서비스하는가? What? Google Mercator 만의특징은무엇인가? Google Maps 의경위도는 WGS84?? 왜 EPSG 는이투영법을무시했을까? 그럼현재는? Tiles for 2D Map Service How? Proj4 GDAL In commercial tools..
1.1 Why Google Mercator?? 왜 Google Mercator 라고부르게됐는가? 출처 : Prof. Dr. Franz-Josef Behr, 2007 왜 Mercator 인가? conformal projection :preserves the shape of relatively small objects. Square buildings should appear square, not rectangular. cylindrical projection :north and south are always straight up and down, and west and east are always straight left and right.
1.1 Why Google Mercator?? 왜 Google Mercator 라고부르게됐는가? 출처 : Prof. Dr. Franz-Josef Behr, 2007 왜 Mercator 인가? conformal projection :preserves the shape of relatively small objects. Square buildings should appear square, not rectangular. cylindrical projection :north and south are always straight up and down, and west and east are always straight left and right.
1.2 Google Mercator based Services? Google Maps, Microsoft Virtual Earth, Yahoo Maps, and other commercial API providers are using the same projection and tiling profile and tiles are therefore compatible. Difference is only in the URL they are using to access the same tile. 출처 : http://www.maptiler.org/google-maps-coordinate-system-projection-epsg-900913-3785/
1.3 Google Mercator is What? Google Spheroid WGS84 타원체의장반경을반지름으로하는구체 경위도 <-> 투영좌표간의변환식이단순해계산이용이 Mercator Projection 위도 0, 경도 0인지점을투영원점 Cylindrical, Conformal을특성을활용 Google Maps 에서경위도는정말로 WGS84 인가? WGS84<->Google Spheroid간의데이텀변환을생략함 즉, Google Spheroid 상의경위도를 WGS84와동일하게취급 측지학적관점에서는위도방향으로왜곡발생 ( 약 +1 30 ~2 40 ) 출처 : http://www.iter.dk/post/2008/05/sphericalweb-mercator-epsg-code-3785.aspx
1.3 Google Mercator is What? Google Spheroid WGS84 타원체의장반경을반지름으로하는구체 경위도 <-> 투영좌표간의변환식이단순해계산이용이 Mercator Projection 위도 0, 경도 0인지점을투영원점 Cylindrical, Conformal을특성을활용 Google Maps 에서경위도는정말로 WGS84 인가? WGS84<->Google Spheroid간의데이텀변환을생략함 즉, Google Spheroid 상의경위도를 WGS84와동일하게취급 측지학적관점에서는위도방향으로왜곡발생 ( 약 +1 30 ~2 40 ) 출처 : http://www.iter.dk/post/2008/05/sphericalweb-mercator-epsg-code-3785.aspx
1.3 Google Mercator is What? Google Spheroid WGS84 타원체의장반경을반지름으로하는구체 경위도 <-> 투영좌표간의변환식이단순해계산이용이 Mercator Projection 위도 0, 경도 0 인지점을투영원점 Cylindrical, Conformal 을특성을활용 Google Maps 에서경위도는정말로 WGS84 인가? WGS84<->Google Spheroid 간의데이텀변환을생략함 즉, Google Spheroid 상의경위도를 WGS84 와동일하게취급 측지학적관점에서는위도방향으로왜곡발생 ( 약 +1 30 ~2 40 ) 이러한이유로 EPSG 는 Google Mercator 를 EPSG Dataset 에등록을거부함 최근에입장을바꿔 EPSG 6.15 버전부터 3785 로등록됨 출처 : http://www.iter.dk/post/2008/05/sphericalweb-mercator-epsg-code-3785.aspx
1.3 Google Mercator is What? Proj4 Definition +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 WKT Definition PROJCS["Popular Visualisation CRS / Mercator", GEOGCS["Popular Visualisation CRS", DATUM["Popular Visualisation Datum", SPHEROID["Popular Visualisation Sphere", 6378137, 0, AUTHORITY["EPSG",7059]], TOWGS84[0, 0, 0, 0, 0, 0, 0], AUTHORITY["EPSG",6055]], PRIMEM["Greenwich", 0, AUTHORITY["EPSG", "8901"]], UNIT["degree", 0.0174532925199433, AUTHORITY["EPSG", "9102"]], AXIS["E", EAST], AXIS["N", NORTH], AUTHORITY["EPSG",4055]], PROJECTION["Mercator"], PARAMETER["False_Easting", 0], PARAMETER["False_Northing", 0], PARAMETER["Central_Meridian", 0], PARAMETER["Latitude_of_origin", 0], UNIT["metre", 1, AUTHORITY["EPSG", "9001"]], AXIS["East", EAST], AXIS["North", NORTH], AUTHORITY["EPSG",3785]] EPSG code EPSG:900913(non-official) EPSG:3785(official) WGS84 장반경 출처 : http://spatialreference.org/ref/user/6/
1.4 Google Mercator, How to? Proj4 http://trac.osgeo.org/proj/ Cartographic Projections library originally written by Gerald Evenden then of the USGS. Currently, led by Frank Warmerdam As of May 2008 PROJ.4 has become part of the MetaCRS project License policy : MIT cs2cs.exe command utility NAME cs2cs.exe - cartographic coordinate system filter SYNOPSIS cs2cs [ -eefilrstvww [ args ] ] [ +opts[=arg] ] [ +to [+opts[=arg]] ] file[s] Ex) TM 중부원점 ->Google Mercator cs2cs +proj=tmerc +lat_0=38n +lon_0=127.0028902777777777776e +ellps=bessel +x_0=200000 +y_0=500000 +k=1.0 +towgs84=- 146.43,507.89,681.46 +no_defs +over +to "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +towgs84=0,0,0 +nadgrids=@null +units=m +no_defs
1.4 Google Mercator, How to? GDAL(Geospatial Data Abstraction Library) http://www.gdal.org/ cross platform C++ translator library for raster and vector geospatial data formats. Include OGR library License policy : X/MIT Command utilities : Vector : ogr2ogr.exe converts simple features data between file formats http://www.gdal.org/ogr/ogr_utilities.html Raster : gdalwarp.exe simple image reprojection and warping utility http://www.gdal.org/gdal_utilities.html Commercial Tools Who knows??? Give me an information!!!
1.4 Google Mercator, How to? ogr2ogr [TM 중부원점 ->WGS84] ogr2ogr -s_srs "+proj=tmerc +ellps=bessel +lat_0=38 +lon_0=127.0028902777777777776e +x_0=200000 +y_0=500000 +k=1.0 +towgs84=- 146.43,507.89,681.46" -t_srs "+proj=latlong +datum=wgs84" -f "ESRI Shapefile" admin_wgs84.shp admin.shp [WGS84->Google Mercator] ogr2ogr -s_srs "+proj=latlong +datum=wgs84" -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 +towgs84=0,0,0 +nadgrids=@null +units=m +no_defs +over" -f "ESRI Shapefile" admin_gmerc.shp admin_wgs84.shp gdalwarp [WGS84->Google Mercator] gdalwarp -s_srs "+proj=latlong +datum=wgs84" -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 +towgs84=0,0,0 +units=m +nadgrids=@null +no_defs" -r bilinear -tr 38.2185141425881 38.2185141425881 -of HFA -co "BLOCKSIZE=128" -wm 256 landsat_korea_wgs84.img landsat_korea_gmerc_38.218.img
2. Google Maps, How to??? Tiles for 2D Map Service Google Maps Compatible Tile Generation Google Maps Styled Pyramid OSGEO TMS Tools for Map Service Mapnik for Vector Rendering gdal2tiles.py in GDAL utilities OpenLayers for Map Browsing
2.1 Tiles for 2D Map Service Google Maps Compatible Tile Generation 타일서비스에최적화에중점 Quad Tree 에기반에 Tile Pyramid 최상위타일크기를 256x256 로설정 : 극지방이서비스지역에서배제 서비스대상지역 경도 : -180~180, 위도 : -85.0511287798~85.0511287798 투영좌표 : -20037508.3427892E~20037508.3427892E -20037508.3427892N~20037508.3427892N 적도의투영길이
2.1 Tiles for 2D Map Service Google Maps Style 좌상단이타일좌표기준점 Quadkey in Virtual Earth tilex = 3 = 011 2 tiley = 5 = 101 2 quadkey = 100111 2 = 2134 = 213 출처 : http://msdn.microsoft.com/en-us/library/bb259689.aspx
2.1 Tiles for 2D Map Service OSGeo TMS 좌하단이타일좌표기준점 Level 1 Level 2 Level 3 (0,1) (1,1) (0,3) (1,3) (2,3) (3,3) (0,7) (1,7) 2,7) (3,7) (4,7) (5,7) (6,7) (7,6) (0,0) (1,0) (0,2) (1,2) (2,2) (3,2) (0,6) (1,6) (2,6) (3,6) (4,6) (5,6) (6,6) (7,6) (0,1) (1,1) (2,1) (3,1) (0,5) (1,5) (2,5) (3,5) (4,5) (5,5) (6,5) (7,5) (0,0) (1,0) (2,0) (3,0) (0,4) (1,4) (2,4) (3,4) (4,4) (5,4) (6,4) (7,4) (0,3) (1,3) (2,3) (3,3) (4,3) (5,3) (6,3) (7,3) (0,2) (1,2) (2,2) (3,2) (4,2) (5,2) (6,2) (7,2) (0,1) (1,1) (2,1) (3,1) (4,1) (5,1) (6,1) (7,1) (0,0) (1,0) (2,0) (3,0) (4,0) (5,0) (6,0) (7,0)
2.2 Tools for Map Service Mapnik Mapping application 개발용툴킷 ( 라이브러리 ) 벡터자료의고급렌더링이목적 사례 : Open Street Map 프로젝트 URL : http://www.mapnik.org/ GDAL utilities gdal2tiles.py generates directory with TMS tiles, KMLs and simple web viewers gdal_retile.py retiles a set of tiles and/or build tiled pyramid levels OpenLayers Open source map browser like Google Maps Pure client-side object-oriented JavaScript library
3. Mapnik What is Mapnik? Mapnik Architecture Mapnik Features Using Mapnik
3.1 What is Mapnik? Mapnik is a free toolkit for developing mapping applications Above all Mapnik is about making beautiful maps It is easily extensible and suitable for both desktop and web development Language support C++ library Python bindings
3.2 Mapnik Architecture
3.3 Mapnik Features Anti-aliasing 지원 by AGG library 다양한 symbolizer 지원 Point/Line/LinePattern/Polygon/PolygonPattern/Text xxxpattern은 image를 texture로사용하는 symbolizer 속성 Filter 기능지원 한글 labeling 가능 True type font 및 global encoding 을지원 Line path를따른 labeling 지원 Point/Line 타입의선택적사용가능 Python 스크립트지원 XML을통한레이어구성 Projection 설정가능
3.4 Using Mapnik LinePattern Symbolizer PolygonPattern Symbolizer Line Symbolizer Line Symbolizer Polygon Symbolizer Text Symbolizer XML Source : shpdemo.xml Shpdemo.xml
3.4 Using Mapnik
4. OpenLayers OpenLayers 란? 맵데이터의표출 / 편집을위한라이브러리 웹기반지리정보어플리케이션개발을위한 API를제공 객체지향방식의 JavaScript만으로개발됨 AJAX(Asynchronous JavaScript and XML) 적용 Server side 종속성이없음 다양한 open/proprietary standards 또는자료소스지원 ex) OGC WMS/WFS, GeoRSS, GML, KML, Google Maps.
5. 질의응답 Q&A
6. Demo Thank you!