Table of Contents

1. Init

(setq org-babel-python-command "/usr/bin/python3")

2. Calculate total length of walked paths

import geojson
from geojson_length import calculate_distance, Unit
with open("laufstrecke.json") as f:
    geodata = geojson.load(f)
features = geodata["features"]
length = 0
for i in features:
    length += calculate_distance(i, Unit.meters)
return length

3. Number of train stations

import geojson
from geojson_length import calculate_distance, Unit
with open("bahn.json") as f:
    geodata = geojson.load(f)
features = geodata["features"]
return len(list(filter(lambda x: "name" in x["properties"], features)))
83
85

4. Number of bus stations

import geojson
from geojson_length import calculate_distance, Unit
with open("bus.json") as f:
    geodata = geojson.load(f)
features = geodata["features"]
return len(list(filter(lambda x: "name" in x["properties"], features)))
29
30
32
34

5. Number of Ortschaften

import geojson
from geojson_length import calculate_distance, Unit
with open("orte.json") as f:
    geodata = geojson.load(f)
features = geodata["features"]
return len(list(filter(lambda x: "place_name" in x["properties"], features)))
263

Author: uni

Created: 2024-02-25 So 12:31