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

FOSS4G Tokyo 2017 ハンズオンデイ: OpenMapTilesで始めるOpen...

FOSS4G Tokyo 2017 ハンズオンデイ: OpenMapTilesで始めるOpenStreetMapのベクトルタイル配信

Taro Matsuzawa aka. btm

September 14, 2017
Tweet

More Decks by Taro Matsuzawa aka. btm

Other Decks in Technology

Transcript

  1. λʔήοτ w λʔήοτ͸6CVOUVͱ͠·͢ w ඞཁͳύοέʔδ͸ҎԼͷ௨ΓͰ͢  HJU PQFONBQUJMFTΛऔಘʹඞཁ  

    NBLF PQFONBQUJMFTͷλεΫ࣮ߦʹར༻   CD RVJDLTUBSUTIͰܭࢉʹ࢖͏   HBXL RVJDLTUBSUTIͰར༻ɺͳ͔ͥBXL΋࢖ͬͯΔ   EPDLFSJP %PDLFSͷຊମɺEPDLFSͱ͍͏ଞͷύοέʔ δ͕͋ΔͷͰ஫ҙ   EPDLFSDPNQPTF ෳ਺ͷ%PDLFSΛ·ͱΊΔ࢓૊Έ
  2. Πϯετʔϧखॱ sudo apt -y install git make bc gawk docker.io

    docker-compose sudo usermod -aG docker $USER w VTFSNPEͰҰൠϢʔβ͕EPDLFSΛѻ͑ΔΑ͏ʹ͠·͢ɻ w ͜ͷ͋ͱϦϒʔτΛ͠·͢ docker run hello-world w ҰൠϢʔβͰEPDLFSSVOΛߦ͍ಈ࡞ςετΛߦ͍·͢ɻ w ͜Ε͕੒ޭͨ͠Β࣍΁ਐΈ·͢
  3. PQFONBQUJMFTΛऔಘ git clone https://github.com/openmaptiles/openmaptiles.git w PQFONBQUJMFTͷϨϙδτϦΛऔಘ͠·͢ cd openmaptiles docker-compose pull

    w EPDLFSDPNQPTFQVMMͰඞཁͳίϯςφΛऔಘ͠·͢ w ͕͔͔࣌ؒΔͷͰ์ஔ͠·͠ΐ͏ w औಘΛ͢Δͱ(#͙Β͍σΟεΫΛফඅ͠·͢
  4. ఏڙ͞ΕΔίϯςφ w 0QFO.BQ5JMFTͰఏڙ͞ΕΔίϯςφʹ͸ҎԼͷΑ͏ͳ΋ͷ ͕͋Δ w σʔλΛऔΓࠐΉͨΊͷ1PTUHSF42-1PTU(*4 w 04.σʔλͷऔΓࠐΈɺߋ৽πʔϧ w (FPGBCSJL͔Βμ΢ϯϩʔυπʔϧ

    w /BUVSBM&BSUIσʔλͳͲ04.Ҏ֎ͷσʔλͷऔΓࠐΈ πʔϧٴͼσʔλ w ग़ྗπʔϧ .BQCPY7FDUPS5JMFͷαʔϒٴͼ.#5JMFT΁ ͷग़ྗ
  5. ೖྗग़ྗ w ೖྗ w 0QFO4USFFU.BQσʔλ 1SPUPDPM#V⒎FSܗࣜ  w /BUVSBM&BSUI 8BUFS

    04.#PSEFS -BLF-JOF w 04.σʔλҎ֎͸%PDLFSͰఏڙ w ग़ྗ w .BQCPY7FDUPS5JMFTΛ.#5JMFTܗࣜʹ·ͱΊͨ΋ͷ
  6. جຊతͳྲྀΕ 04.σʔλ QCGϑΝ Πϧ Λ(FPGBCSJDL͔Βμ ΢ϯϩʔυ PQFONBQUJMFTUPPMT ͰCVJMEҎԼʹϑΝΠϧΛ ࡞੒ 1PTUHSF42-

    1PTU(*4 Λ ىಈ XBUFS PTNCPSEFS  OBUVSBMFBSUI MBLFMJOFT ΛΠϯϙʔτ JNQPTNΛ࢖ͬͯ04. σʔλΛΠϯϙʔτ ϕΫτϧλΠϧΛग़ྗ ͢Δͷʹར༻͢Δ42- ؔ ਺ ΛΠϯϙʔτ .BQCPY7FDUPS5JMFΛ .#5JMFTܗࣜʹग़ྗ .#5JMFTʹ ϝλσʔλΛ෇༩ %PDLFSίϯςφΛ ΫϦʔϯΞοϓ 1PTUHSF42- 1PTU(*4 Λ ఀࢭ
  7. ࡞੒ޙͷνΣοΫ w NBLFTUBSUUJMFTFSWFSΛ࣮ߦ͢Δ make start-tileserver w %PDLFSͰىಈ͢Δͱ͍͏ํ๏΋͋Δ docker pull klokantech/tileserver-gl


    docker run -it --rm -v $$(pwd)/data:/data \ -p 8080:80 klokantech/tileserver-gl w NBLF͸্هίϚϯυΛλεΫʹ͍ͯ͠Δ͚ͩ
  8. UJMFTFSWFSHMͷ࣮ߦ w ͲͪΒ΋NCUJMFT͕͋ΔσΟϨΫτϦͰ࣮ߦ͢Δ w %PDLFSͷ৔߹ docker run -it --rm -v

    $(pwd):/data \ -p 8080:80 klokantech/tileserver-gl npm install -g tileserver-gl cd $(directory contain mbtiles) tileserver-gl -p 8080 w OQNͷ৔߹
  9. .BQVUOJLͷ࣮ߦ w ͲͷσΟϨΫτϦͰ΋ྑ͍ w %PDLFSͷ৔߹ docker run docker run -d

    -p 8888:8888 maputnik/editor npm install -g serve wget https://github.com/maputnik/editor/releases/download/ v1.0.2/public.zip unzip public.zip serve -p 8888 w OQN TFSWF ͷ৔߹
  10. ൺֱ ΞϧόχΞ [[ [[ 5IJOLQBE9 $PSFJDPSF (#.FNPSZ44% NJO NJO .BDCPPL1SP

     NJE  $PSFJDPSF (#.FNPSZ44% NJO ଌఆෆՄ ϋϯάΞοϓ ͘͞ΒΫϥ΢υ DPSF(#.FNPSZ NJO ܭଌͰ͖ͣ ग़ྗαΠζ ,# .#
  11. ಺෦Ͱ࢖͏ϓϩάϥϜ w JNQPTN w 04.σʔλͷΠϯϙʔτʹར༻ w UJMFMJWFDPQZ w UJMFMJWFͷιʔε͔Β.#5JMFTܗࣜʹग़ྗ͢Δͷʹར༻ w

    0QFO.BQ5JMFTͰ͸UN .BQCPY4UVEJP$MBTTJD ͱͯ͠ѻ͏ w QPTUTFSWF w 1PTU(*4͔Β.BQCPY7FDUPS5JMFܗࣜʹग़ྗ͢ΔͨΊͷαʔό w 45@"4.75ؔ਺Λར༻ w ͳ͓ɺىಈ͢Δ͕ར༻͸͞Εͯͳ͍ Ṗ
  12. JNQPTNͷDBDIFΛࢀর $ docker volume ls DRIVER VOLUME NAME local openmaptiles_cache

    local openmaptiles_pgdata $ docker run -it -v openmaptiles_cache:/cache alpine /bin/sh / # ls /cache coords inserted_ways nodes relations ways / # du -h /cache 22.4M /cache/coords 248.0K /cache/relations 24.0K /cache/inserted_ways 2.2M /cache/nodes 12.7M /cache/ways 37.6M /cache