Mercurial > hg > ChinaGisRestApi
changeset 144:abc95f483315
polygon-Layers
author | fknauft |
---|---|
date | Thu, 03 Feb 2011 13:22:57 +0100 |
parents | 6d9ff64bb16b |
children | 303a6de26031 |
files | RestDbGisApi.py |
diffstat | 1 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/RestDbGisApi.py Thu Feb 03 12:45:50 2011 +0100 +++ b/RestDbGisApi.py Thu Feb 03 13:22:57 2011 +0100 @@ -295,21 +295,23 @@ kmlData.append(kmlPlace) if geomField=='poly' and len(geomdata)>0: geom_list=geomdata.values() - polys=str(geom_list[1]).split('(')[4].split(')') + polys=str(geom_list[1]).split('(') + aaa=len(polys) for poly in polys: - coords=poly.split(',') - coord_string='' - for coord in coords: - coord=coord.split(' ') - try: - x_coord=coord[0] - y_coord=coord[1] - except: - break - coord_string+=x_coord+','+y_coord+','+'0 \n' - kmlPlace['LinearRing']=coord_string - kmlPlace['LineColor']=colorField - kmlData.append(kmlPlace) + coords=poly.replace(')','').split(',') + if len(coords)>1: + coord_string='' + for coord in coords: + coord=coord.split(' ') + try: + x_coord=coord[0] + y_coord=coord[1] + except: + break + coord_string+=x_coord+','+y_coord+','+'0 \n' + kmlPlace['LinearRing']=coord_string + kmlPlace['LineColor']=colorField + kmlData.append(kmlPlace) #logging.debug("kmlData=%s"%(repr(kmlData))) return kmlData