目的
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()