summaryrefslogtreecommitdiff
path: root/script.py
blob: 9e01e0b37dd5c9de5e41c95306875cfc753ba0df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python

import os
import geojson 

features = []


folder = "html/files"
for file in os.listdir(folder):
	print(file)
	data=file.rsplit('-',3)
	print(data[1], data[2],data[3])
	typ = ""
	if data[3].endswith(".ogg"):
		typ = "sound"
	if data[3].endswith(".jpeg"):
		typ = "image"
	features.append(geojson.Feature(geometry=geojson.Point((float(data[2]), float(data[1]))), properties={"type": typ,"file": file}))

#dump = geojson.dumps(geojson.FeatureCollection(features), sort_keys=True) 
dump = geojson.dumps(features, sort_keys=True) 
print(dump)
f = open('html/data.geojson', 'w')
f.write(dump)
f.close()