view zpt/KML_schema_table.zpt @ 278:4ade9b80b563 default tip

more cleanup. descriptions work better now.
author casties
date Fri, 24 Feb 2012 16:41:30 +0100
parents d1b43624cc63
children
line wrap: on
line source

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:tal="http://xml.zope.org/namespaces/tal" 
  tal:define="gisIdField python:request.get('gis_id_field',None); 
  colorField python:request.get('color_field','red');
  latField python:request.get('lat_field',None); 
  lonField python:request.get('lon_field',None); 
  geomField python:request.get('geometry_field','point');
  sortBy python:request.get('sort_field',1); 
  ids python:request.get('id');
  from_year_name python:request.get('from_year_name','from_year');
  until_year_name python:request.get('until_year_name','until_year');
  schema options/schema; table options/table; 
  data python:here.getKmlData(schema=schema,table=table,sortBy=sortBy,ids=ids,gisIdField=gisIdField,
  latField=latField,lonField=lonField,geomField=geomField,colorField=colorField,
  from_year_name=from_year_name,until_year_name=until_year_name); 
  withLine python:request.get('connect_line',None);">
  <Document>
    <Style id="marker_icon_red">
      <IconStyle>
        <scale>"10"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_red.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_black">
      <IconStyle>
        <scale>"0.2"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_black.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_blue">
      <IconStyle>
        <scale>"0.2"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_blue.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_green">
      <IconStyle>
        <scale>"0.2"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_green.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_violett">
      <IconStyle>
        <scale>"0.2"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_violett.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
    <Style id="marker_icon_red_big">
      <IconStyle>
        <scale>"10"</scale> 
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_red_big.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_black_big">
      <IconStyle>
        <scale>"0.2"</scale> 
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_black_big.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_blue_big">
      <IconStyle>
        <scale>"0.2"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_blue_big.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_green_big">
      <IconStyle>
        <scale>"0.2"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_green_big.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
   <Style id="marker_icon_violett_big">
      <IconStyle>
        <scale>"0.2"</scale>
        <Icon>
          <href>http://mappit.mpiwg-berlin.mpg.de/mappit/icons/dot_violett_big.png</href>
        </Icon>
        <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
      </IconStyle>
    </Style>
    <Style id="red_line">
      <LineStyle>
        <color>ff0000ff</color>
        <width>2</width>
      </LineStyle>
    </Style>
      <Style id="green_line">
      <LineStyle>
        <color>ff00ff00</color>
        <width>2</width>
      </LineStyle>
    </Style>
   <Style id="black_line">
      <LineStyle>
        <color>ff000000</color>
        <width>2</width>
      </LineStyle>
    </Style>
   <Style id="violett_line">
      <LineStyle>
        <color>ffff00ff</color>
        <width>2</width>
      </LineStyle>
    </Style>
   <Style id="blue_line">
      <LineStyle>
        <color>ffff0000</color>
        <width>2</width>
      </LineStyle>
    </Style>
    <Style id="red_big_line">
      <LineStyle>
        <color>ff0000ff</color>
        <width>4</width>
      </LineStyle>
    </Style>
      <Style id="green_big_line">
      <LineStyle>
        <color>ff00ff00</color>
        <width>4</width>
      </LineStyle>
    </Style>
   <Style id="black_big_line">
      <LineStyle>
        <color>ff000000</color>
        <width>4</width>
      </LineStyle>
    </Style>
   <Style id="violett_big_line">
      <LineStyle>
        <color>ffff00ff</color>
        <width>4</width>
      </LineStyle>
    </Style>
   <Style id="blue_big_line">
      <LineStyle>
        <color>ffff0000</color>
        <width>4</width>
      </LineStyle>
    </Style>
    <Style id="blue_poly">
      <LineStyle>
        <color>ffff0000</color>
        <width>2</width>
      </LineStyle>
      <PolyStyle>
        <color>ffff0000</color>
      </PolyStyle>
    </Style>
    <Style id="black_poly">
      <LineStyle>
        <color>ff000000</color>
        <width>2</width>
      </LineStyle>
      <PolyStyle>
        <color>ff000000</color>
      </PolyStyle>
    </Style>
    <Placemark tal:repeat="place data" tal:condition="python:here.trydatahas_key(data,0,'icon')">
      <description tal:content="place/description">
      ERD-0815: ERD-0815
      </description>
      <TimeStamp tal:condition="python:here.trydatahas_key(data,0,'TimeStamp')">
        <when tal:content="place/TimeStamp"></when>
      </TimeStamp>
      <TimeSpan tal:condition="python:here.trydatahas_key(data,0,'TimeSpan0')">
        <begin tal:content="place/TimeSpan0" ></begin>
        <end tal:content="place/TimeSpan1"></end>
      </TimeSpan>
      <styleUrl tal:content="place/icon" >#marker_icon_red</styleUrl>
      <Point tal:condition="python:place.has_key('icon')">
        <extrude>1</extrude>
        <coordinates tal:content="string:${place/coord_x},${place/coord_y},${place/coord_z}">116.38,39.92,0</coordinates>
      </Point>
    </Placemark>
    <Placemark tal:repeat="place data" tal:condition="python:here.trydatahas_key(data,0,'LinearRing')">
      <name>Border-Line</name>
      <description tal:content="place/description" >
      ERD-0815: ERD-0815
      </description>
      <TimeStamp tal:condition="python:here.trydatahas_key(data,0,'TimeStamp')">
        <when tal:content="place/TimeStamp"></when>
      </TimeStamp>
      <TimeSpan tal:condition="python:here.trydatahas_key(data,0,'TimeSpan0')">
        <begin tal:content="place/TimeSpan0" ></begin>
        <end tal:content="place/TimeSpan1"></end>
      </TimeSpan>
      <styleUrl tal:content="place/lineColor" >#red_line</styleUrl>
      <LineString>
       <extrude>1</extrude>
       <tessellate>1</tessellate>
       <coordinates tal:content="string:${place/LinearRing}">116.38,39.92,0</coordinates>
      </LineString>
    </Placemark> 
    <Placemark tal:condition="withLine">
      <name>Path</name>
      <description>Red line visualizes path between locations</description>
      <styleUrl>#red_line</styleUrl>
      <LineString>
        <extrude>1</extrude>
        <tessellate>1</tessellate>
        <altitudeMode>clampToGround</altitudeMode>
        <coordinates>
          <tal:span tal:repeat="place data" tal:content="string:${place/coord_x},${place/coord_y},${place/coord_z}">116.38,39.92,0</tal:span>
        </coordinates>
      </LineString>
    </Placemark>
   </Document>
</kml>