#! /usr/bin/env python # -*- coding: utf-8 -*- """ Creates KML file with station info. License Copyright 2012 Kasper D. Fischer This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. $Id$ """ import simplekml # create new empty KML file kml = simplekml.Kml() # create empyt folder to contain styles and stations stationsFolder = kml.newfolder(name="Stations") # station types stationTypes = { 'broadband': {'textColor': '#003560', 'pointSize': 10, 'pointColor': '#ff0000'}, 'shortperiod': {'textColor': '#003560', 'pointSize': 10, 'pointColor': '#ffa500'}, 'auxiliary': {'textColor': '#003560', 'pointSize': 8, 'pointColor': '#ffff00'}, 'geothermie': {'textColor': '#003560', 'pointSize': 10, 'pointColor': '#ffff00'} } # setting station info stations = { 'BUG, BKLB': [( 7.2693, 51.4406), 'broadband', 1, "GRSN station BUG, STS-2 seismometer
RuhrNet station BKLB, GS-13 seismometer"], 'BULI': [( 7.2602, 51.4544), 'auxiliary', 0, 'RuhrNet station BULI, Mark L4c-3D seismometer'], 'BTEZ': [( 7.2790, 51.4490), 'auxiliary', 0, 'RuhrNet station BTEZ, GS-13 seismometer'], 'BPFI': [( 7.2276, 51.4185), 'auxiliary', 0, 'RuhrNet station BBFI, Mark L4c-3D seismometer'], 'HMES': [( 7.7263, 51.6578), 'broadband', 0, 'RuhrNet station HMES, Trillium 40 seismometer'], 'BRHE': [( 6.5710, 51.5155), 'shortperiod', 0, 'RuhrNet station BRHE, Mark L4c-3D seismometer'], 'ZERL': [( 6.8695, 51.6207), 'shortperiod', 0, 'RuhrNet station ZERL, Mark L4c-3D seismometer'], 'ZER1': [( 6.8252, 51.5947), 'auxiliary', 0, 'RuhrNet station ZER1, Mark L4c-3D seismometer'], 'ZER2': [( 6.9060, 51.5871), 'auxiliary', 0, 'RuhrNet station ZER2, Mark L4c-3D seismometer'], 'ZER3': [( 6.8384, 51.6128), 'auxiliary', 0, 'RuhrNet station ZER3, Mark L4c-3D seismometer'], 'BAVN': [( 7.1220, 51.7380), 'broadband', 0, 'RuhrNet station BAVN, STS-2 seismometer'], 'BAVS': [( 7.1331, 51.7000), 'auxiliary', 0, 'RuhrNet station BAVS, Mark L4c-3D seismometer'], 'IBBN': [( 7.7566, 52.3072), 'broadband', 0, 'GEOFON station IBBN, STS-2 seismometer'], 'IBBE': [( 7.7943, 52.2998), 'auxiliary', 0, 'RuhrNet station IBBE, Mark L4c-3D seismometer'], 'IBBS': [( 7.7486, 52.2843), 'auxiliary', 0, 'RuhrNet station IBBS, Mark L4c-3D seismometer'], 'KERA': [(23.5577, 35.3692), 'broadband', 0, 'GEOFON station KERA, STS-2 seismometer'], 'KARP': [(27.1612, 35.5472), 'broadband', 0, 'GEOFON station KARP, STS-2 seismometer'] } # adding station markers for key, value in stations.iteritems(): pnt = stationsFolder.newpoint( name = key, coords = [(value[0][0], value[0][1])], description = value[3] ) pnt.extendeddata.newdata('pntsize', stationTypes[value[1]]['pointSize']) pnt.extendeddata.newdata('pntcolor', stationTypes[value[1]]['pointColor']) pnt.extendeddata.newdata('tcolor', stationTypes[value[1]]['textColor']) pnt.extendeddata.newdata('extrastation', value[2]) # saving the KML file kml.save('stations.kml')