Skip to content

Instantly share code, notes, and snippets.

@cm3
Created December 22, 2019 07:24
Show Gist options
  • Save cm3/6868b2293a7c7a257f7dfe8f86e0ae8e to your computer and use it in GitHub Desktop.
Save cm3/6868b2293a7c7a257f7dfe8f86e0ae8e to your computer and use it in GitHub Desktop.
print geojson of shrines in the historical map data provided by nihu https://www.nihu.jp/ja/publication/source_map
import csv
template_body = """
{{
"type": "FeatureCollection",
"features": [{items}]
}}
"""
template_item = """
{{
"type": "Feature",
"geometry": {{
"type": "Point",
"coordinates": [{lng}, {lat}]
}},
"properties": {{
"name": "{name}",
"_markerType": "Icon",
"_iconUrl": "https://maps.gsi.go.jp/portal/sys/v4/symbols/080.png",
"_iconAnchor": [
10,
10
]
}}
}}
"""
items = []
with open('地名.txt', encoding='utf-8') as f:
reader = csv.reader(f)
next(reader, None)
for row in reader:
#print(row[2])
if row[2] == "12":
items.append(template_item.format(name=row[1],lat=row[4],lng=row[5]))
print(template_body.format(items=",\n".join(items)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment