changeset 135:ac22bb1e3212

polygon-Layers
author fknauft
date Wed, 02 Feb 2011 18:34:49 +0100
parents 649681baae76
children 42d7cd64e87c
files RestDbGisApi.py zpt/KML_schema_table.zpt
diffstat 2 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/RestDbGisApi.py	Wed Feb 02 17:16:16 2011 +0100
+++ b/RestDbGisApi.py	Wed Feb 02 18:34:49 2011 +0100
@@ -293,11 +293,11 @@
                 kmlPlace['coord_y'] = str(yCoord)
                 kmlPlace['coord_z'] = '0'
                 kmlData.append(kmlPlace)
-            if geomField=='poly':
-                for value in geomdata:
-                  alert(str(value))
-                  kmlPlace['LinearRing']=str(value).split('(')[4]                
-                  kmlData.append(kmlPlace)
+            if geomField=='poly' and len(geomdata)>0:
+                geom_list=geomdata.values()
+                strvalue=str(geom_list[1])
+                kmlPlace['LinearRing']=str(geom_list[1]).split('(')[4]                
+                kmlData.append(kmlPlace)
                 kmlPlace['LineColor']=colorField
         #logging.debug("kmlData=%s"%(repr(kmlData)))
         return kmlData
--- a/zpt/KML_schema_table.zpt	Wed Feb 02 17:16:16 2011 +0100
+++ b/zpt/KML_schema_table.zpt	Wed Feb 02 18:34:49 2011 +0100
@@ -61,18 +61,22 @@
         <color>ff0000ff</color>
       </PolyStyle>
     </Style>
-    <Placemark tal:repeat="place data" >
-      <description tal:content="place/description" tal:condition="python:place/icon">
+    <Placemark tal:repeat="place data" tal:condition="python:data[0].has_key('icon')">
+      <description tal:content="place/description" >
       ERD-0815: ERD-0815
       </description>
-#      <styleUrl tal:content="place/icon" >#marker_icon</styleUrl>
-      <styleUrl tal:content="place/icon" tal:condition="python:place/icon">#marker_icon_red</styleUrl>
-      <Point tal:condition="python:place/icon">
+      <styleUrl tal:content="place/icon" >#marker_icon_red</styleUrl>
+      <Point tal:condition="python:place.has_key('icon')">
         <coordinates tal:content="string:${place/coord_x},${place/coord_y},${place/coord_z}">116.38,39.92,0</coordinates>
       </Point>
-      <Style tal:condition="python:place/LinearRing">
+    </Placemark>
+    <Placemark tal:repeat="place data" tal:condition="python:data[0].has_key('LinearRing')">
+      <description tal:content="place/description" >
+      ERD-0815: ERD-0815
+      </description>
+      <Style>
          <PolyStyle><color tal:content="place/LineColor">#80800000</color><fill>1</fill><outline>1</outline></PolyStyle></Style>
-      <MultiGeometry tal:condition="python:place/LinearRing"><Polygon><outerBoundaryIs><LinearRing><coordinates tal:content="string:${place/LinearRing}">116.38,39.92,0</coordinates>
+      <MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates tal:content="string:${place/LinearRing}">116.38,39.92,0</coordinates>
           </LinearRing></outerBoundaryIs></Polygon></MultiGeometry>
     </Placemark> 
     <Placemark tal:condition="withLine">