changeset 262:6613b9204bda

Small bugs
author fknauft
date Tue, 01 Nov 2011 18:04:26 +0100
parents 5b38b50052e4
children 3a10287447b1
files RestDbGisApi.py zpt/KML_schema_table.zpt
diffstat 2 files changed, 37 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/RestDbGisApi.py	Fri Oct 07 15:58:07 2011 +0200
+++ b/RestDbGisApi.py	Tue Nov 01 18:04:26 2011 +0100
@@ -294,17 +294,27 @@
                 return None
                     
             if geomField=='point' :
-              if float(xCoord) == 0.0:        
-                continue
-              if float(yCoord) == 0.0:
-                continue
+              if type(xCoord).__name__=='string':  
+                  if float(xCoord) == 0.0:        
+                      continue
+              else:  
+                  if xCoord == 0.0:        
+                      continue
+              if type(yCoord).__name__=='string':  
+                  if float(yCoord) == 0.0:        
+                      continue
+              else:  
+                  if yCoord == 0.0:        
+                      continue
 
             kmlPlace = {}
             
             # description
             desc = ''
            
- 
+            timestring = ''
+            beg_yr = ''
+            end_yr = ''
             for i in range (len(dataset)):
                 value = dataset[i]
                 
@@ -318,10 +328,13 @@
                     #elif name.find('place')>-1:
                     #    desc += "<name>%s</name>\n"%value
                     #    continue
-            
+                    
                     val = "%s: %s"%(name, value)
                     value=unicode(value)
-            
+                    if name == 'beg_yr':
+                       beg_yr= value
+                    if name == 'end_yr':
+                       end_yr=value
             # If there is a link within the description data, create a valid href
                     if value.find('http://')>-1:
                         link_str_beg=value.find('http://')
@@ -346,6 +359,11 @@
                       
             #kmlPlace['description'] = "<![CDATA[%s]]>"%desc
             
+            if beg_yr!='':
+                if end_yr!='':
+                   kmlPlace['TimeSpan'] = '<begin>%s</begin><end>%s</end>'%(beg_yr,end_yr)
+                else:
+                   kmlPlace['TimeStamp'] = '<when>%s</when>'%beg_yr
                   
             if geomField=='point':
                 kmlPlace['description'] = "<![CDATA[%s]]>"%desc
@@ -376,6 +394,8 @@
                             kmlPlace['LinearRing']=coord_string              
                             kmlPlace['lineColor']='#'+colorField+'_'+geomField
                             kmlData.append(kmlPlace)
+ 
+                
         #logging.debug("kmlData=%s"%(repr(kmlData)))
         return kmlData
 
--- a/zpt/KML_schema_table.zpt	Fri Oct 07 15:58:07 2011 +0200
+++ b/zpt/KML_schema_table.zpt	Tue Nov 01 18:04:26 2011 +0100
@@ -179,6 +179,11 @@
       <description tal:content="place/description">
       ERD-0815: ERD-0815
       </description>
+      <TimeStamp tal:content="place/TimeStamp" tal:condition="python:here.trydatahas_key(data,0,'TimeStamp')">
+      </TimeStamp>
+      <TimeSpan tal:content="place/TimeSpan" tal:condition="python:here.trydatahas_key(data,0,'TimeSpan')">
+      </TimeSpan>
+      
       <styleUrl tal:content="place/icon" >#marker_icon_red</styleUrl>
       <Point tal:condition="python:place.has_key('icon')">
         <extrude>1</extrude>
@@ -190,6 +195,11 @@
       <description tal:content="place/description" >
       ERD-0815: ERD-0815
       </description>
+      <TimeStamp tal:content="place/TimeStamp" tal:condition="python:here.trydatahas_key(data,0,'TimeStamp')">
+      </TimeStamp>
+      <TimeSpan tal:content="place/TimeSpan" tal:condition="python:here.trydatahas_key(data,0,'TimeSpan')">
+      </TimeSpan>
+
       <styleUrl tal:content="place/lineColor" >#red_line</styleUrl>
       <LineString>
        <extrude>1</extrude>