LoginSignup
0
0

More than 3 years have passed since last update.

タブローで地図情報を扱う時

Posted at

目的

BigQueryにある緯度経度情報をTableauで可視化したい

問題

緯度経度情報(GEO系)をBigqueryでPOINTとかに変換してもTableauで文字列としてしか認識してくれない

解決方法

・python でshapeファイルに変換(geojsonとかでもなんでもいいと思う)

サンプルコード

import csv
import shapefile

w = shapefile.Writer("../data/point", shapeType=shapefile.POINT)

w.field("id", "C", "40")
w.field("date", "C", "40")
w.field("price", "C", "40")
w.field("flg", "C", "40")

with open("../data/___.csv") as text:
    reader = csv.DictReader(text)
    for row in reader:
        w.record(str(row['id']), str(row['date']), str(row['price']), str(row['flg']))
        w.point(float(row['longitude']), float(row['latitude']))

w.close()
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0