--- /dev/null
+#!/usr/bin/python3
+import argparse
+import sys
+from typing import TextIO
+
+import geojson
+
+import wrpylib.wrmwmarkup
+from wrpylib.argparse_tools import bool_type
+from wrpylib.wrgeojson import join_sledrun_map_ways, simplify_ways
+
+
+def geojson_to_geojson(input: TextIO, output: TextIO, join_ways: bool, simplify: bool):
+ """Converts geojson to wrmap
+
+ :param input: input geojson file
+ :param output: output geojson file
+ :param join_ways: joins subsequent ways of same type
+ :param simplify: true to simplify ways
+ """
+ wr_geojson = geojson.load(input)
+ if not wr_geojson.is_valid:
+ raise ValueError(f'Invalid GeoJSON: {wr_geojson.errors()}')
+
+ # Merge sledrun ways of the same type
+ if join_ways:
+ join_sledrun_map_ways(wr_geojson)
+
+ # Simplify the sledrunMap
+ if simplify:
+ simplify_ways(wr_geojson)
+
+ # Print result
+ print(wrpylib.wrmwmarkup.create_wrmap(wr_geojson), file=output)
+ print('{{Landkarte Legende}}<br/>{{GoogleMaps Hinweis}}')
+ print()
+
+
+def main():
+ parser = argparse.ArgumentParser(description='Converts Winterrodeln geojson format to itself.'
+ 'Reads from stdin, writes to stdout.')
+ parser.add_argument('--join-ways', type=bool_type, default=True,
+ help='joins subsequent ways of same type (default: True)')
+ parser.add_argument('--simplify', type=bool_type, default=False,
+ help='simplify the map (reduce number of points in paths) (default: False)')
+ args = parser.parse_args()
+
+ geojson_to_geojson(sys.stdin, sys.stdout, args.join_ways, args.simplify)
+
+
+if __name__ == '__main__':
+ main()