X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plc-kml.py;h=2a1ecf9ebd5fe6cd10a5852d236f64145e9a5543;hb=refs%2Fheads%2F4.3;hp=aa972cd247a3023c56d83babcf3de22b675c5611;hpb=a64d1ce39dc82e36334104c885e727e5f7f99c34;p=myplc.git diff --git a/plc-kml.py b/plc-kml.py index aa972cd..2a1ecf9 100755 --- a/plc-kml.py +++ b/plc-kml.py @@ -13,9 +13,11 @@ import sys -default_output = "/var/www/html/sites/sites.kml" -default_local_icon = "sites/google-local.png" -default_foreign_icon = "sites/google-foreign.png" +default_output = "/var/www/html/sites/sites.kml" +default_local_icon = "sites/google-local.png" +default_foreign_icon = "sites/google-foreign.png" +default_local_builtin = "palette-4.png" +default_foreign_builtin = "palette-3.png" class KmlMap: @@ -34,16 +36,13 @@ class KmlMap: def write(self,string): self.output.write(string.encode("UTF-8")) + # mention local last @staticmethod def site_compare (s1,s2): - n1=s1['name'] - n2=s2['name'] - if n1n2: - return 1 - else: - return 0 + p1 = p2 = 0 + if s1['peer_id']: p1=s1['peer_id'] + if s2['peer_id']: p2=s2['peer_id'] + return p2-p1 def refresh (self): self.open() @@ -134,15 +133,19 @@ class KmlMap: # close description description +='' + if not self.options.labels: + name="" + description="" + # STYLE if self.options.use_google_icons: if not peer_id: # local sites - iconfile="palette-4.png" + iconfile=default_local_builtin xyspec="12803232" else: # remote - iconfile="palette-3.png" + iconfile=default_foreign_builtin xyspec="16003232" iconurl="root://icons/%(iconfile)s"%locals() else: @@ -180,6 +183,9 @@ def main () : parser.add_option("-o","--output",action="store",dest="output", default=default_output, help="output file - default is %s"%default_output) + parser.add_option("-n","--no-label",action="store_false",dest="labels", + default=True, + help="outputs only geographic positions, no labels") parser.add_option("-c","--custom",action="store_false",dest="use_google_icons", default=True, help="use locally customized icons rather than the google-provided defaults") @@ -189,6 +195,7 @@ def main () : parser.add_option("-f","--foreign",action="store",dest="foreign_icon", default=default_foreign_icon, help="set icon url to use for foreign sites marker -- default is %s"%default_foreign_icon) + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help()