Skip to content

Instantly share code, notes, and snippets.

@smellman
Created July 9, 2015 06:21
Show Gist options
  • Select an option

  • Save smellman/8462c7cb4d6529245dcc to your computer and use it in GitHub Desktop.

Select an option

Save smellman/8462c7cb4d6529245dcc to your computer and use it in GitHub Desktop.
東京都水道局 震災時の給水拠点 のCSVをgeojsonに変換
# -*- coding: utf-8
import codecs
import csv
import geojson
features = []
with codecs.open("kyoten.csv", 'r', 'shift_jis') as f:
reader = csv.reader(f)
header = next(reader)
for row in reader:
feature = geojson.Feature(
geometry=geojson.Point([float(row[2]), float(row[1])]),
properties={
'id': row[0],
'name': row[3],
'type': row[4],
'potential': row[5],
'address': row[6],
'photo_url': row[7],
'update_date': row[8],
'remark': row[9]
})
features.append(feature)
feature_collection = geojson.FeatureCollection(features)
fp = open("kyoten.geojson", 'w')
fp.write(geojson.dumps(feature_collection, indent=4))
fp.close()
@smellman
Copy link
Copy Markdown
Author

smellman commented Jul 9, 2015

pip install geojson
python convert_kyoten.py

データは以下のサイトからゲットします。
http://www.waterworks.metro.tokyo.jp/kurashi/shinsai/kyoten.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment