SlideShare a Scribd company logo
1 of 18
Download to read offline
YAHOO! Maps API 3.8
       Introduction

         Y!KR maps engineering
                     2009 Jan
Agenda


▐     What is Y!Map API? (5min)
▐     What is Y!Geo API? (5min)
▐     Mash-up examples (5min)
▐     Feature description (10min)
▐     Using proxy and Json Call-Back (5min)
▐     Code examples (10min)
▐     Step by step tutoring (10min)
▐     Exercise (20min)
▐     Q & A (10min)

▐ Coffee break!!

Yahoo! - published (Slide 2)
What is Y!Map API?
  세계 지도

  위성지도

  손쉽고 다양한 내/외부API
                                                Satellite Map
  세계 표준 좌표 계 (WGS84 경위도)

  다양한 브라우저 지원 (FireFox, IE, Opera9, Safari3)

  오랜 사용자 지원으로 인한 안정성 및 세계적 커뮤니티                 World Map




                                                Easy to use

Yahoo! - published (Slide 3)
What is Y!Geo API?
  버스/지하철 정류장 검색 API

  좌표 계 변환 API

  POI 검색 API

  주소 ↔ 좌표 변환 API (Geocoder)

  다양한 출력 방식 (Json, XML, PHP serialize, Json callback)

  UTF-8 표준 REST 인코딩 포멧




Yahoo! - published (Slide 4)
Mash-up examples
   Yahoo map + Virtual reality mash up




   http://www.oggle.ca/

   Yahoo map + geography mash up         Yahoo map + Memory mash up




Yahoo! - published (Slide 5)
Mash-up examples
   Yahoo map + VML Drawing technique




 http://www.9-interactive.com/
   Yahoo map + people connection




  http://www.townkings.com
Yahoo! - published (Slide 6)
Feature description




                                        YMarker


                                                     YPolyline



                       Geo calculator




            Customizable feature          YEvent
                                                   Wizard
Yahoo! - published (Slide 7)
Using proxy and Json Call-Back
▐ 외부의 데이터를 다루기 위한 “JSON call back”


     <script src=quot;http://kr.open.gugi.yahoo.com/service/rgc.php?appid=YahooDemo&
                   latitude=37.511411132213&longitude=127.05925359288&output=json&callback=mycallbackquot;></script>



      function mycallback(response){
        if(typeof response == quot;objectquot;){
          var hdata=response.ResultSet.head;
          if(hdata.Error>0){
            alert(hdata.ErrorMessage);
          }else{
            var location=response.ResultSet.location;
            alert(quot;this location is : quot;+location.country+quot; quot;+location.state+quot; quot;+location.county+quot; quot;+location.town);
          }
        }else{
          alert(quot;api connection errorquot;);
        }
      }




Yahoo! - published (Slide 8)
Using proxy and Json Call-Back
▐ 외부의 데이터를 다루기 위한 “asyncRequest”


     RequestAsnc();


      //connection fail control
      var handle_RequestAsnc_fail = function(o){
        alert(quot;async request was failquot;);
      }

      //data handle
      var handle_RequestAsnc_success = function(o){
        alert(quot;successquot;);
      }

      //callback define
      var callback_RequestAsnc={success: handle_RequestAsnc_success,failure: handle_RequestAsnc_fail};

      //origin function
      function RequestAsnc(){
        var requestUrl=quot;/ymap/sendRequest.phpquot;; //proxy page. ajax has domain restriction.
        var postValue=quot;type=xml&utf8=yes&goUrl=quot;+encodeURIComponent(testuri);
        var request = YAHOO.util.Connect.asyncRequest('POST', requestUrl, callback_RequestAsnc, postValue);
      }



How to avoid “cross domain” policy?                       Make server side proxy page or apache proxy
Yahoo! - published (Slide 9)
Code examples
▐ Map initializing

   <script type=quot;text/javascriptquot; src=quot;http://kr.open.gugi.yahoo.com/Client/AjaxMap.php?v=3.8&appid=YahooDemoquot;></script>




   var map;
   function StartYMap()
   {
                 // 지도 오브젝트를 생성 합니다.
                 map = new YMap(document.getElementById('map'));
                 // WGS84 좌표계의 경위도 좌표 오브젝트를 전달하여 위치를 지정
                 var center_point = new YGeoPoint(37.511411132213,127.05925359288);
                 //YGeoPoint or YCoordPoint , ZoomLevel. zoom=1~17
                 map.drawZoomAndCenter(center_point,1);
   }
   window.onload = StartYMap;




   <body>
   <div id=quot;mapquot;></div>
   </body>




Yahoo! - published (Slide 10)
Code examples
▐ Using Mercator projections
                                (example)
                                LatLon to Pixel XY from equator and date-time line

                                var px = map.MP.ll_to_pxy(map.getCenterLatLon().Lat , map.getCenterLatLon().Lon);
                                var x= px.x;
                                var y=px.y;




Yahoo! - published (Slide 11)
Step by step tutoring
Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기

      1. 기본 HTML page 만들기




참고 url : Reverser Geocoder http://kr.open.gugi.yahoo.com/document/geocooder.php
Yahoo! - published (Slide 12)
Step by step tutoring
Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기

      1. 기본 HTML page 만들기

         <html>
         <head>
         <style type=quot;text/cssquot;>
         #map{
                       height: 400px;
                       width: 100%;
         }
         </style>
         </head>

         <body>
                      <div id=quot;mapquot;>
                                    <div style=quot;position:relative;z-index:1;padding-left:80px;padding-top:9px;font-weight:bold;quot;>
                                                  <div style=quot;float:left;position:relative;width:120px;quot;>현재의 위치는 : </div>
                                                  <div id=quot;indicatorquot; style=quot;float:left;position:relative;width:500px;quot;></div>
                                    </div>
                                    <div style=quot;width:100%;height:25px;padding:4px;z-index:1;position:absolute;top:0;left:0;
         border:1px solid purple;background-color:blue;filter:alpha(opacity=10);opacity : 0.1quot;></div>
                      </div>
         </body>
         </html>




Yahoo! - published (Slide 13)
Step by step tutoring
Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기

      2. 지도 API 삽입하기
         <html>
         <head>
         <script type=quot;text/javascriptquot; src=quot;http://kr.open.gugi.yahoo.com/Client/AjaxMap.php?v=3.8&appid=YahooDemoquot;></script>
         <style type=quot;text/cssquot;>
         #map{
                       height: 400px;
                       width: 100%;
         }
         </style>
         <script type=quot;text/javascriptquot;>
         <!--
         var map;
         function StartYMap()
         {
                       map = new YMap(document.getElementById('map'));
                       map.addTypeControl();
                       map.addZoomLong();
                       map.addPanControl();
                       map.setMapType(YAHOO_MAP_REG);
                       map.drawZoomAndCenter('seoul',9);
         }
         window.onload = StartYMap;
         </head>




Yahoo! - published (Slide 14)
Step by step tutoring
Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기

      3. 이벤트 핸들러 지정하기
         function StartYMap()
         {
                       map = new YMap(document.getElementById('map'));
                       map.addTypeControl();
                       map.addZoomLong();
                       map.addPanControl();
                       map.setMapType(YAHOO_MAP_REG);
                       map.drawZoomAndCenter('seoul',9);

                           YEvent.Capture(map, EventsList.endMapDraw, whereami);
                           YEvent.Capture(map, EventsList.endPan, whereami);
                           YEvent.Capture(map, EventsList.endAutoPan, whereami);
         }

         function whereami(){
                                                              //중심점 구하기
                      var _c=map.getCenterLatLon();
                      var lat=_c.Lat;
                      var lon=_c.Lon;
                      var param=quot;appid=YahooDemo&output=json&callback=printdata&latitude=quot;+lat+quot;&longitude=quot;+lon;
                      var myurl=quot;http://kr.open.gugi.yahoo.com/service/rgc.php?quot;+param;
                      var rnd = YUtility.getRandomID();
                      var _id = 'rgc:'+rnd;
                      YUtility.dynamicSNode(_id,myurl);
         }



Yahoo! - published (Slide 15)
Step by step tutoring
Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기

      4. 데이터 처리 함수 작성 하기

         function printdata(obj){
                       if(typeof obj==quot;objectquot;){
                                     var h=obj.ResultSet.head;
                                     if(parseInt(h.Error)>0){
                                                    alert(h.ErrorMessage);
                                     }else{
                                                    var country=obj.ResultSet.location.country;
                                                    var state=obj.ResultSet.location.state;
                                                    var county=obj.ResultSet.location.county;
                                                    var town=obj.ResultSet.location.town;
                                                    if(country!=null){
                                                                  document.getElementById(quot;indicatorquot;).innerHTML =
                                                                               country+quot; > quot;+state+quot; > quot;+county+quot; > quot;+town;
                                                                     }
                                     }
                       }else{
                                     alert(quot;data handle errorquot;);
                       }
         }




Yahoo! - published (Slide 16)
Exercise

▐ POI 검색 API 사용하기



                                Poisearch.html을 참고하여 지도API를 넣은 후

                                검색 버튼과 poisearch api를 연동하여 검색후

                                결과를 Ymarker를 통해 지도위에 표현해 보자




참고 url : http://kr.open.gugi.yahoo.com/document/poisearch.php
Yahoo! - published (Slide 17)
▐ Q and A




Yahoo! - published (Slide 18)

More Related Content

Similar to Y Map Mashup Camp

JSplash - Adobe MAX 2009
JSplash - Adobe MAX 2009JSplash - Adobe MAX 2009
JSplash - Adobe MAX 2009
gyuque
 
Mobile And The Latency Trap
Mobile And The Latency TrapMobile And The Latency Trap
Mobile And The Latency Trap
Tom Croucher
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
ady36
 
Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09
helggeist
 

Similar to Y Map Mashup Camp (20)

jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuff
 
JSplash - Adobe MAX 2009
JSplash - Adobe MAX 2009JSplash - Adobe MAX 2009
JSplash - Adobe MAX 2009
 
Mgd08 lab01
Mgd08 lab01Mgd08 lab01
Mgd08 lab01
 
Programming JNI
Programming JNIProgramming JNI
Programming JNI
 
GeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri ProjectGeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri Project
 
Android Animation (in tamil)
Android Animation (in tamil)Android Animation (in tamil)
Android Animation (in tamil)
 
YUI 3
YUI 3YUI 3
YUI 3
 
KODE JS POKENNNNN
KODE JS POKENNNNNKODE JS POKENNNNN
KODE JS POKENNNNN
 
Mobile And The Latency Trap
Mobile And The Latency TrapMobile And The Latency Trap
Mobile And The Latency Trap
 
Java
JavaJava
Java
 
MashUp Mania: How Reebok Created the Ultimate Mashup and You Can Too
MashUp Mania: How Reebok Created the Ultimate Mashup and You Can TooMashUp Mania: How Reebok Created the Ultimate Mashup and You Can Too
MashUp Mania: How Reebok Created the Ultimate Mashup and You Can Too
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
 
Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008
 
Merb jQuery
Merb jQueryMerb jQuery
Merb jQuery
 
Tilting Google Maps and MissileLauncher
Tilting Google Maps and MissileLauncherTilting Google Maps and MissileLauncher
Tilting Google Maps and MissileLauncher
 
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
 
Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09Devclub Servicemix Jevgeni Holodkov 23 04 09
Devclub Servicemix Jevgeni Holodkov 23 04 09
 
GIS and Google Earth In Geography
GIS and Google Earth In GeographyGIS and Google Earth In Geography
GIS and Google Earth In Geography
 

More from Jinho Jung

Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기
Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기
Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기
Jinho Jung
 

More from Jinho Jung (20)

[Ignite 강남 2016] 천성권 지속가능한 딸바보로 살기
[Ignite 강남 2016] 천성권 지속가능한 딸바보로 살기[Ignite 강남 2016] 천성권 지속가능한 딸바보로 살기
[Ignite 강남 2016] 천성권 지속가능한 딸바보로 살기
 
[Ignite 강남 2016] 조현길 경영자처럼 일할테니 경영자의 월급을 주세ᄋ...
[Ignite 강남 2016] 조현길 경영자처럼 일할테니 경영자의 월급을 주세ᄋ...[Ignite 강남 2016] 조현길 경영자처럼 일할테니 경영자의 월급을 주세ᄋ...
[Ignite 강남 2016] 조현길 경영자처럼 일할테니 경영자의 월급을 주세ᄋ...
 
[Ignite 강남 2016] 이지현 비주얼씽킹 세계여행
[Ignite 강남 2016] 이지현 비주얼씽킹 세계여행[Ignite 강남 2016] 이지현 비주얼씽킹 세계여행
[Ignite 강남 2016] 이지현 비주얼씽킹 세계여행
 
[Ignite 강남 2016] 장정화-내인생을바꾼 improv
[Ignite 강남 2016] 장정화-내인생을바꾼 improv[Ignite 강남 2016] 장정화-내인생을바꾼 improv
[Ignite 강남 2016] 장정화-내인생을바꾼 improv
 
[Ignite 강남 2016] 김영진-당신의 이름에서 회사를 지우면?
[Ignite 강남 2016] 김영진-당신의 이름에서 회사를 지우면?[Ignite 강남 2016] 김영진-당신의 이름에서 회사를 지우면?
[Ignite 강남 2016] 김영진-당신의 이름에서 회사를 지우면?
 
[Ignite 강남 2016] 유소희-job nomad
[Ignite 강남 2016] 유소희-job nomad[Ignite 강남 2016] 유소희-job nomad
[Ignite 강남 2016] 유소희-job nomad
 
[Ignite 강남 2016] 김태길 무엇이든 적어보세요
[Ignite 강남 2016] 김태길 무엇이든 적어보세요[Ignite 강남 2016] 김태길 무엇이든 적어보세요
[Ignite 강남 2016] 김태길 무엇이든 적어보세요
 
[Ignite 강남 2016] 유혜경-사회복지사의 공감력고군분투
[Ignite 강남 2016] 유혜경-사회복지사의 공감력고군분투[Ignite 강남 2016] 유혜경-사회복지사의 공감력고군분투
[Ignite 강남 2016] 유혜경-사회복지사의 공감력고군분투
 
[Ignite 강남 2016] 정기원-스타트업계의 멋진 여자들을 인터뷰해보았다
[Ignite 강남 2016] 정기원-스타트업계의 멋진 여자들을 인터뷰해보았다[Ignite 강남 2016] 정기원-스타트업계의 멋진 여자들을 인터뷰해보았다
[Ignite 강남 2016] 정기원-스타트업계의 멋진 여자들을 인터뷰해보았다
 
[Ignite 강남 2016] 이미화-일상,조용한혁명
[Ignite 강남 2016] 이미화-일상,조용한혁명[Ignite 강남 2016] 이미화-일상,조용한혁명
[Ignite 강남 2016] 이미화-일상,조용한혁명
 
[Ignite 강남 2016] 정해인 아빠가 먼저 피아노 배워도 되겠니
[Ignite 강남 2016] 정해인 아빠가 먼저 피아노 배워도 되겠니[Ignite 강남 2016] 정해인 아빠가 먼저 피아노 배워도 되겠니
[Ignite 강남 2016] 정해인 아빠가 먼저 피아노 배워도 되겠니
 
[Ignite 강남 2016] 황준석-사회생활 초년생의 꿈을 찾는 항해
[Ignite 강남 2016] 황준석-사회생활 초년생의 꿈을 찾는 항해[Ignite 강남 2016] 황준석-사회생활 초년생의 꿈을 찾는 항해
[Ignite 강남 2016] 황준석-사회생활 초년생의 꿈을 찾는 항해
 
[Ignite 강남 2016] 차성국 아들과 함께한 국토대장정
[Ignite 강남 2016] 차성국 아들과 함께한 국토대장정[Ignite 강남 2016] 차성국 아들과 함께한 국토대장정
[Ignite 강남 2016] 차성국 아들과 함께한 국토대장정
 
[Ignite 강남 2016] 김홍균 모든 것은 누군가의 상상에서 시작됐다
[Ignite 강남 2016] 김홍균 모든 것은 누군가의 상상에서 시작됐다[Ignite 강남 2016] 김홍균 모든 것은 누군가의 상상에서 시작됐다
[Ignite 강남 2016] 김홍균 모든 것은 누군가의 상상에서 시작됐다
 
[Ignite 강남 2016] 정예진 맞춤법은 꼭 지켜야합니다
[Ignite 강남 2016] 정예진 맞춤법은 꼭 지켜야합니다[Ignite 강남 2016] 정예진 맞춤법은 꼭 지켜야합니다
[Ignite 강남 2016] 정예진 맞춤법은 꼭 지켜야합니다
 
Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기
Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기
Ignite seoul 8회 12 천성권 혼나지 않는 남편으로 살기
 
행복한 1인기업 이야기 : Happy 1Man Company
행복한 1인기업 이야기 : Happy 1Man Company행복한 1인기업 이야기 : Happy 1Man Company
행복한 1인기업 이야기 : Happy 1Man Company
 
Hackathon & hack day 이야기
Hackathon & hack day 이야기Hackathon & hack day 이야기
Hackathon & hack day 이야기
 
서울스케쳐 전시계획서
서울스케쳐 전시계획서서울스케쳐 전시계획서
서울스케쳐 전시계획서
 
행복화실 2014 - 12주 과정 Happy drawing 2014
행복화실 2014 - 12주 과정 Happy drawing 2014행복화실 2014 - 12주 과정 Happy drawing 2014
행복화실 2014 - 12주 과정 Happy drawing 2014
 

Recently uploaded

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Recently uploaded (20)

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Y Map Mashup Camp

  • 1. YAHOO! Maps API 3.8 Introduction Y!KR maps engineering 2009 Jan
  • 2. Agenda ▐ What is Y!Map API? (5min) ▐ What is Y!Geo API? (5min) ▐ Mash-up examples (5min) ▐ Feature description (10min) ▐ Using proxy and Json Call-Back (5min) ▐ Code examples (10min) ▐ Step by step tutoring (10min) ▐ Exercise (20min) ▐ Q & A (10min) ▐ Coffee break!! Yahoo! - published (Slide 2)
  • 3. What is Y!Map API?  세계 지도  위성지도  손쉽고 다양한 내/외부API Satellite Map  세계 표준 좌표 계 (WGS84 경위도)  다양한 브라우저 지원 (FireFox, IE, Opera9, Safari3)  오랜 사용자 지원으로 인한 안정성 및 세계적 커뮤니티 World Map Easy to use Yahoo! - published (Slide 3)
  • 4. What is Y!Geo API?  버스/지하철 정류장 검색 API  좌표 계 변환 API  POI 검색 API  주소 ↔ 좌표 변환 API (Geocoder)  다양한 출력 방식 (Json, XML, PHP serialize, Json callback)  UTF-8 표준 REST 인코딩 포멧 Yahoo! - published (Slide 4)
  • 5. Mash-up examples Yahoo map + Virtual reality mash up http://www.oggle.ca/ Yahoo map + geography mash up Yahoo map + Memory mash up Yahoo! - published (Slide 5)
  • 6. Mash-up examples Yahoo map + VML Drawing technique http://www.9-interactive.com/ Yahoo map + people connection http://www.townkings.com Yahoo! - published (Slide 6)
  • 7. Feature description YMarker YPolyline Geo calculator Customizable feature YEvent Wizard Yahoo! - published (Slide 7)
  • 8. Using proxy and Json Call-Back ▐ 외부의 데이터를 다루기 위한 “JSON call back” <script src=quot;http://kr.open.gugi.yahoo.com/service/rgc.php?appid=YahooDemo& latitude=37.511411132213&longitude=127.05925359288&output=json&callback=mycallbackquot;></script> function mycallback(response){ if(typeof response == quot;objectquot;){ var hdata=response.ResultSet.head; if(hdata.Error>0){ alert(hdata.ErrorMessage); }else{ var location=response.ResultSet.location; alert(quot;this location is : quot;+location.country+quot; quot;+location.state+quot; quot;+location.county+quot; quot;+location.town); } }else{ alert(quot;api connection errorquot;); } } Yahoo! - published (Slide 8)
  • 9. Using proxy and Json Call-Back ▐ 외부의 데이터를 다루기 위한 “asyncRequest” RequestAsnc(); //connection fail control var handle_RequestAsnc_fail = function(o){ alert(quot;async request was failquot;); } //data handle var handle_RequestAsnc_success = function(o){ alert(quot;successquot;); } //callback define var callback_RequestAsnc={success: handle_RequestAsnc_success,failure: handle_RequestAsnc_fail}; //origin function function RequestAsnc(){ var requestUrl=quot;/ymap/sendRequest.phpquot;; //proxy page. ajax has domain restriction. var postValue=quot;type=xml&utf8=yes&goUrl=quot;+encodeURIComponent(testuri); var request = YAHOO.util.Connect.asyncRequest('POST', requestUrl, callback_RequestAsnc, postValue); } How to avoid “cross domain” policy? Make server side proxy page or apache proxy Yahoo! - published (Slide 9)
  • 10. Code examples ▐ Map initializing <script type=quot;text/javascriptquot; src=quot;http://kr.open.gugi.yahoo.com/Client/AjaxMap.php?v=3.8&appid=YahooDemoquot;></script> var map; function StartYMap() { // 지도 오브젝트를 생성 합니다. map = new YMap(document.getElementById('map')); // WGS84 좌표계의 경위도 좌표 오브젝트를 전달하여 위치를 지정 var center_point = new YGeoPoint(37.511411132213,127.05925359288); //YGeoPoint or YCoordPoint , ZoomLevel. zoom=1~17 map.drawZoomAndCenter(center_point,1); } window.onload = StartYMap; <body> <div id=quot;mapquot;></div> </body> Yahoo! - published (Slide 10)
  • 11. Code examples ▐ Using Mercator projections (example) LatLon to Pixel XY from equator and date-time line var px = map.MP.ll_to_pxy(map.getCenterLatLon().Lat , map.getCenterLatLon().Lon); var x= px.x; var y=px.y; Yahoo! - published (Slide 11)
  • 12. Step by step tutoring Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기 1. 기본 HTML page 만들기 참고 url : Reverser Geocoder http://kr.open.gugi.yahoo.com/document/geocooder.php Yahoo! - published (Slide 12)
  • 13. Step by step tutoring Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기 1. 기본 HTML page 만들기 <html> <head> <style type=quot;text/cssquot;> #map{ height: 400px; width: 100%; } </style> </head> <body> <div id=quot;mapquot;> <div style=quot;position:relative;z-index:1;padding-left:80px;padding-top:9px;font-weight:bold;quot;> <div style=quot;float:left;position:relative;width:120px;quot;>현재의 위치는 : </div> <div id=quot;indicatorquot; style=quot;float:left;position:relative;width:500px;quot;></div> </div> <div style=quot;width:100%;height:25px;padding:4px;z-index:1;position:absolute;top:0;left:0; border:1px solid purple;background-color:blue;filter:alpha(opacity=10);opacity : 0.1quot;></div> </div> </body> </html> Yahoo! - published (Slide 13)
  • 14. Step by step tutoring Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기 2. 지도 API 삽입하기 <html> <head> <script type=quot;text/javascriptquot; src=quot;http://kr.open.gugi.yahoo.com/Client/AjaxMap.php?v=3.8&appid=YahooDemoquot;></script> <style type=quot;text/cssquot;> #map{ height: 400px; width: 100%; } </style> <script type=quot;text/javascriptquot;> <!-- var map; function StartYMap() { map = new YMap(document.getElementById('map')); map.addTypeControl(); map.addZoomLong(); map.addPanControl(); map.setMapType(YAHOO_MAP_REG); map.drawZoomAndCenter('seoul',9); } window.onload = StartYMap; </head> Yahoo! - published (Slide 14)
  • 15. Step by step tutoring Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기 3. 이벤트 핸들러 지정하기 function StartYMap() { map = new YMap(document.getElementById('map')); map.addTypeControl(); map.addZoomLong(); map.addPanControl(); map.setMapType(YAHOO_MAP_REG); map.drawZoomAndCenter('seoul',9); YEvent.Capture(map, EventsList.endMapDraw, whereami); YEvent.Capture(map, EventsList.endPan, whereami); YEvent.Capture(map, EventsList.endAutoPan, whereami); } function whereami(){ //중심점 구하기 var _c=map.getCenterLatLon(); var lat=_c.Lat; var lon=_c.Lon; var param=quot;appid=YahooDemo&output=json&callback=printdata&latitude=quot;+lat+quot;&longitude=quot;+lon; var myurl=quot;http://kr.open.gugi.yahoo.com/service/rgc.php?quot;+param; var rnd = YUtility.getRandomID(); var _id = 'rgc:'+rnd; YUtility.dynamicSNode(_id,myurl); } Yahoo! - published (Slide 15)
  • 16. Step by step tutoring Y!Map API와 Reverse Geocoder를 이용하여 현재 위치 표시하기 4. 데이터 처리 함수 작성 하기 function printdata(obj){ if(typeof obj==quot;objectquot;){ var h=obj.ResultSet.head; if(parseInt(h.Error)>0){ alert(h.ErrorMessage); }else{ var country=obj.ResultSet.location.country; var state=obj.ResultSet.location.state; var county=obj.ResultSet.location.county; var town=obj.ResultSet.location.town; if(country!=null){ document.getElementById(quot;indicatorquot;).innerHTML = country+quot; > quot;+state+quot; > quot;+county+quot; > quot;+town; } } }else{ alert(quot;data handle errorquot;); } } Yahoo! - published (Slide 16)
  • 17. Exercise ▐ POI 검색 API 사용하기 Poisearch.html을 참고하여 지도API를 넣은 후 검색 버튼과 poisearch api를 연동하여 검색후 결과를 Ymarker를 통해 지도위에 표현해 보자 참고 url : http://kr.open.gugi.yahoo.com/document/poisearch.php Yahoo! - published (Slide 17)
  • 18. ▐ Q and A Yahoo! - published (Slide 18)