Skip to content
/ sslkml Public

Converting "Suomen Suunnistusliiton Karttarekisteri" data to KML

License

Notifications You must be signed in to change notification settings

jvtm/sslkml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSL Karttarekisteri / Map Registry KML tool

SSL ain't SSL. SSL is The Finnish Orienteering Federation.

The official Map Registry lives at karttarekisteri.fi. This project convers the official data into more usable format.

Conversion script is coded in Python and has been tested on Python versions 2.6 and 2.7.

Note: "Karttarekisteri" is the only official place for Finnish Orienteering Federation's embargoed areas. So, if you consider yourself a kilpasienestäjä, you must use it. This project doesn't take any responsibility of anything. The conversion script might malform or lose data.

The tool can output different KML files for:

  • Orienteering maps
  • Sprint maps
  • Ski-O maps
  • MTB-O maps
  • Trail-O maps
  • Opetuskartat(tm)
  • Embargoed areas / Harjoituskieltoalueet

You can also download already formatted KML files from (will maybe setup some kind of website).

Why?

  • karttarekisteri.fi usability sucks
  • Flash? No thanks.
  • Using proper KML means easy integration with Google Earth, Google Maps, OpenLayers etc
  • KML data can be used on a mobile device (eg. Android version of Google Maps)
  • It might be possible to import map information ito various GPS devices
  • Everything is better in Sweden
  • Data wants to be free

What is converted?

The original data files look like KML, but there are some differences:

  • Coordinates are in ETRS-TM35FIN format, not in the usual WGS84 Lat/Lon format.
  • Polygons are missing the last vertex (so the last line is not rendered)
  • Placemark names are just numeric IDs
  • Broken altitude data (maybe it is used for something else)
  • Some coordinate data seems to be corrupted
  • There are no links to full map info

Libraries

It might be that you need to install some Python libraries:

  • lxml for XML parsing and modifications (plain ElementTree is not enough)
  • argh for command line actions
  • coordinates.py was taken from fetch_map project by Olli Lammi. Used for coordinate conversion.
  • TODO: pyproj? this could be used also, but requires a C library and whatnot...

Installing libraries:

  • Debian/Ubuntu (or any other) Linux there might be packages called python-lxml, python-argh.
  • MacOSX I personally use virtualenvwrapper from MacPorts and pip. Once setup use commands like pip install lxml and pip install argh.
  • Windows... not sure. Try latest official Python MSI and then use pip?

Usage

Download and convert all seven map types to ssl-<maptype>-<timestamp>.kml files:

python -m sslkml.conv download

Download only MTBO map info (otherwise same as above):

python -m sslkml.conv download mtbo

Convert existing file to KML:

cat downloaded.kml | python -m sslkml.conf convert > converted.kml

Both actions also have --help command line switch.

Screenshots

Orienteering Map KML loaded into Google Earth

karttarekisteri.fi public URLs

Warning: laji=1 might be too big XML document and crash your browser.

TODO

  • public website using openlayers or leaflet
  • change colors for other map types
  • --log-level switch
  • --save-orig to save downloaded contents too
  • --download-only to only download, no conversion done
  • setup.py
  • PyPi upload

About

Converting "Suomen Suunnistusliiton Karttarekisteri" data to KML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages