Upgrade to Pro — share decks privately, control downloads, hide ads and more …

明日から使えるGoogle maps platform 入門

nekoze
February 26, 2019
290

明日から使えるGoogle maps platform 入門

nekoze

February 26, 2019
Tweet

Transcript

  1. ࣗݾ঺հ • ௕Ԭ େथ (ͳ͕͓͔ ͍͖ͩ) • 1994೥ੜ·Ε(24ࡀ) • Twitter:

    @nekoze_da • ܦྺ • 1~1.4೥໨:ɹɹɹגࣜձ͙ࣾΔͳͼ • 1.5೥໨ʙݱࡏ:ɹ JapanTaxiגࣜձࣾ • झຯ • ήʔϜ/μʔπ/ϓϩάϥϛϯά/ಛࡱ/ࣗ࡞ΩʔϘʔυ/
 ےτϨ/ϥϯχϯά/Թઘ/ΞΩόࢄࡦ
  2. ࠓ೔ͷ͓࿩ ᶃ Google Maps Platformͱ͸ • શମ૾΍࢖͍ํΛ೺Ѳ͠Α͏ ᶄ Google Maps

    PlatformϋϯζΦϯ • ஍ਤΛWEBαΠτʹදࣔͤ͞Α͏ • Ң౓ܦ౓͔ΒॅॴΛऔಘ͠Α͏ • Ωʔϫʔυ͔ΒॅॴީิΛऔಘ͠Α͏
  3. MAP API • Google Mapͷ஍ਤΛදࣔ͢ΔͨΊͷAPI • Javascript • iOS SDK

    • Android SDK • etc... • ஍ਤͷελΠϧɺϚʔΧʔɺϥΠϯɺը૾·ͰৄࡉʹΧελϚΠ ζՄೳ
  4. ϚʔΧʔΛදࣔ͢Δ • new google.maps.Marker(Φϓγϣϯ(object))ͰϚʔΧʔΛදࣔ • position: ϚʔΧʔΛग़ݱ͍ͤͨ͞Ң౓ܦ౓ ྫ: { lat:

    35.681236, lng: 139.767125 } • map: ϚʔΧʔΛग़ݱ͍ͤͨ͞ର৅ͷmap • ͦͷଞΦϓγϣϯ͸υΩϡϝϯτΛ֬ೝ
  5. Ң౓ܦ౓͔Βॅॴ৘ใΛऔಘ͢Δ • Geocoding APIΛ࢖༻ • ύϥϝʔλ • latlng: Ң౓, ܦ౓

    • language: දࣔݴޠ • key: APIΩʔ curl -X GET 'https: //maps.googleapis.com/maps/api/geocode/json? latlng=35.681236,139.767125&language=ja&key=AIzaSyACJ066_Ge7arr_5qQMdDthr 7p_k9eFeRA'
  6. Ωʔϫʔυ͔Βॅॴ৘ใͷީิΛ औಘ͢Δ • Place Autocomplete APIΛ࢖༻ • ύϥϝʔλ • input:

    Ң౓, ܦ౓ • location: ݕࡧͷى఺ͱͳΔҢ౓,ܦ౓ • radius: location͔Βͷݕࡧൣғ(ϝʔτϧ) • language: දࣔݴޠ • key: APIΩʔ curl -X GET ‘https: //maps.googleapis.com/maps/api/place/autocomplete/json? input=౦ژυʔϜ &location=35.681236,139.767125&radius=5000&language=ja&key=AIzaSyACJ066_Ge7 arr_5qQMdDthr7p_k9eFeRA'
  7. ࠓճͭ͘Δ΋ͷ • ஍ਤΛදࣔ͢Δ(Maps JavaScript API) • ϚʔΧʔΛදࣔ͢Δ(Maps JavaScript API) •

    ϚʔΧʔʹ഑ஔͨ͠৔ॴͷॅॴ৘ใ͕දࣔ ͞ΕΔ(Geocoding API) • ݕࡧ૭ʹΩʔϫʔυΛೖྗ͢Δͱॅॴީิ ͕දࣔ͞ΕΔ (Place Autocomplete API) ϦϑΝϨϯεURL: https://developers.google.com/maps/ documentation/javascript/reference/
  8. ϓϩδΣΫτͷ४උ git clone https://github.com/nekoze1210/GoogleMapsPlatform_SampleApp.git Terminal cd GoogleMapsPlatform_SampleApp bundle install bundle

    exec rails s bundle exec rails db:create dockerΛ࢖༻͠ͳ͍৔߹(Ruby: 2.6.1) open http://localhost:3000 ./config/database.ymlΛฤू(username, password, hostΛมߋ)