Exemple #1
0
 def advanced_kml_output(self,
                         title='Location Indicators',
                         output_filename='output_advanced.kml',
                         color_ramp=[1, 500, 1000],
                         polygon_height=1000):
     f = open(output_filename, "w")
     header2 = header.replace('__title__', title)
     f.write(header2)
     for key, value in self.locations.items():
         value = int(value)
         if value < 1: continue
         #print(key,value)
         t = self.get_template(value, color_ramp=color_ramp)
         poly = self.makeGoogleEarthBox(key)
         height = value * polygon_height
         # This is a 'ceiling' value to prevent the 3d polygons from getting to tall.
         # TODO: remove this constraint for visualization
         if height > MAX_POLYGON_HEIGHT:
             height = MAX_POLYGON_HEIGHT
         height = str(height)
         poly = poly.replace("elevation", height)
         t = t.replace("__name__", key)
         t = t.replace("__coordinates__", poly)
         t = t.replace('__title__', title)
         f.write(t + "\n")
     f.write(footer)
Exemple #2
0
 def advanced_kml_output(self,
                         title='Location Indicators',
                         output_filename='output_advanced.kml',
                         color_ramp=[1, 500, 1000],
                         polygon_height=1000):
     f = open(output_filename, "w")
     header2 = header.replace('__title__', title)
     f.write(header2)
     for key, value in self.locations.items():
         value = int(value)
         if value < 1: continue
         print(key, value)
         t = self.get_template(value, color_ramp=color_ramp)
         poly = self.makeGoogleEarthBox(key)
         #TODO: remove this constraint for visualization
         if value > 50000:
             value = 50000
         height = value * polygon_height
         height = str(height)
         poly = poly.replace("elevation", height)
         t = t.replace("__name__", key)
         t = t.replace("__coordinates__", poly)
         t = t.replace('__title__', title)
         f.write(t + "\n")
     f.write(footer)
Exemple #3
0
 def quartiles_kml_output(self,
                          title='Location Indicators',
                          output_filename='output_advanced.kml',
                          color_divides=[1, 500, 1000],
                          polygon_height=1000):
     f = open(output_filename, "w")
     header2 = header.replace('__title__', title)
     f.write(header2)
     for key, value in self.locations.items():
         #value = int(value)
         #if value < 1: continue
         t = self.get_template(value, color_ramp=color_divides)
         poly = self.makeGoogleEarthBox(key)
         poly = poly.replace("elevation", 1)
         t = t.replace("__name__", key)
         t = t.replace("__coordinates__", poly)
         t = t.replace('__title__', title)
         f.write(t + "\n")
     f.write(footer)
 def simple_kml_output(self,title='Location Indicators',output_filename ='output_simple.kml' ):
     f = open(output_filename,"w")
     header2 = header.replace('__title__',title)
     f.write(header2)
     for key,value in self.locations.items():
         value = int(value)
         if value < 1: continue
         print key,value
         t = box_template
         poly = self.makeGoogleEarthBox(key)
         #TODO: remove this constraint for visualization
         if value > 40:
             value = 40
         height = value * 400
         height = str(height)
         poly = poly.replace("elevation",height)
         t = t.replace("__name__",key)
         t = t.replace("__coordinates__",poly)
         f.write(t+"\n")
     f.write(footer)
Exemple #5
0
 def advanced_kml_output(self,title='Location Indicators',output_filename ='output_advanced.kml',color_ramp=[1,500,1000],polygon_height=1000):
     f = open(output_filename,"w")
     header2 = header.replace('__title__',title)
     f.write(header2)
     for key,value in self.locations.items():
         value = int(value)
         if value < 1: continue
         print key,value
         t = self.get_template(value,color_ramp=color_ramp)
         poly = self.makeGoogleEarthBox(key)
         #TODO: remove this constraint for visualization
         if value > 50000:
             value = 50000
         height = value * polygon_height
         height = str(height)
         poly = poly.replace("elevation",height)
         t = t.replace("__name__",key)
         t = t.replace("__coordinates__",poly)
         t = t.replace('__title__',title)
         f.write(t+"\n")
     f.write(footer)