Split up in 5 Python files:
- image_convert.py: main file, containing the GUI
- map_transform.py: projections, map reading, etc.
- geometry.py: small helper for map_transform.py
- database.py: generate the database
- rivers.py: the river algorithm
And various modifications.
It's now working even if it's still buggy and not documented.