First commit

This commit is contained in:
2025-10-03 22:48:16 +01:00
commit fcba00eb3e
43 changed files with 12439 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
10.740350000000001,
59.90970000000001
]
},
"properties": {
"names": [
"SLMOslo"
],
"count": 1,
"popup": "SLMOslo"
}
}
]
}

View File

@@ -0,0 +1,124 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
10.42,
59.21
]
},
"properties": {
"names": [
"BoltJW"
],
"count": 1,
"popup": "BoltJW"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
5.32,
60.39
]
},
"properties": {
"names": [
"Markos"
],
"count": 1,
"popup": "Markos"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
5.8,
58.870000000000005
]
},
"properties": {
"names": [
"PupFenling"
],
"count": 1,
"popup": "PupFenling"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
6.97,
51.45
]
},
"properties": {
"names": [
"PianoVanBarkhoven"
],
"count": 1,
"popup": "PianoVanBarkhoven"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
20.98,
70.04
]
},
"properties": {
"names": [
"NordicSub"
],
"count": 1,
"popup": "NordicSub"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
11.26,
60.33
]
},
"properties": {
"names": [
"PupCatalyst"
],
"count": 1,
"popup": "PupCatalyst"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
5.75,
58.86
]
},
"properties": {
"names": [
"PupSebbi"
],
"count": 1,
"popup": "PupSebbi"
}
}
]
}

View File

@@ -0,0 +1,42 @@
import csv
import json
from collections import defaultdict
csv_file = "places.csv"
geojson_file = "data/places.geojson"
GROUP_TOLERANCE = 0.00001 # cluster distance in degrees
def round_coord(coord):
return round(coord / GROUP_TOLERANCE) * GROUP_TOLERANCE
clusters = defaultdict(list)
with open(csv_file, newline='', encoding='utf-8') as f:
reader = csv.DictReader(f)
for row in reader:
lat = float(row['latitude'])
lon = float(row['longitude'])
name = row['name']
key = (round_coord(lat), round_coord(lon))
clusters[key].append(name)
features = []
for (lat, lon), names in clusters.items():
features.append({
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [lon, lat] },
"properties": {
"names": names,
"count": len(names),
"popup": ", ".join(names)
}
})
geojson = { "type": "FeatureCollection", "features": features }
with open(geojson_file, "w", encoding='utf-8') as f:
json.dump(geojson, f, indent=2)
print(f"Generated {geojson_file} with {len(features)} clustered POIs.")