Created
July 9, 2015 06:21
-
-
Save smellman/8462c7cb4d6529245dcc to your computer and use it in GitHub Desktop.
東京都水道局 震災時の給水拠点 のCSVをgeojsonに変換
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- 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() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
データは以下のサイトからゲットします。
http://www.waterworks.metro.tokyo.jp/kurashi/shinsai/kyoten.html