Mercurial > hg > ChinaGisRestApi
comparison RestDbGisApi.py @ 127:7ed8de30af56
polygon-Layers
author | fknauft |
---|---|
date | Wed, 02 Feb 2011 14:50:54 +0100 |
parents | 89386036e661 |
children | a949b69bc2a9 |
comparison
equal
deleted
inserted
replaced
126:89386036e661 | 127:7ed8de30af56 |
---|---|
159 # add timestamp so URL changes every time | 159 # add timestamp so URL changes every time |
160 params.append(('timestamp',timestamp)) | 160 params.append(('timestamp',timestamp)) |
161 paramstr = urllib.urlencode(params) | 161 paramstr = urllib.urlencode(params) |
162 return "%s/db/%s/%s?%s"%(baseUrl,schema,table,paramstr) | 162 return "%s/db/%s/%s?%s"%(baseUrl,schema,table,paramstr) |
163 | 163 |
164 def getKmlData(self, schema, table, ids=None, sortBy=1, gisIdField=None, latField=None, lonField=None, geometry="point", color_field="red"): | 164 def getKmlData(self, schema, table, ids=None, sortBy=1, gisIdField=None, latField=None, lonField=None, geomField="point", colorField="red"): |
165 """returns data structure for KML template""" | 165 """returns data structure for KML template""" |
166 logging.debug("getKMLdata gid=%s lat=%s lon=%s"%(gisIdField,latField,lonField)) | 166 logging.debug("getKMLdata gid=%s lat=%s lon=%s"%(gisIdField,latField,lonField)) |
167 # Mapping a set of points from table-based SQL-query: | 167 # Mapping a set of points from table-based SQL-query: |
168 qstr='SELECT * FROM "%s"."%s"'%(schema,table) | 168 qstr='SELECT * FROM "%s"."%s"'%(schema,table) |
169 idList = None | 169 idList = None |
285 desc += '<br/>\n' | 285 desc += '<br/>\n' |
286 | 286 |
287 #kmlPlace['description'] = "<![CDATA[%s]]>"%desc | 287 #kmlPlace['description'] = "<![CDATA[%s]]>"%desc |
288 kmlPlace['description'] = desc | 288 kmlPlace['description'] = desc |
289 | 289 |
290 if geometry=='point': | 290 if geomField=='point': |
291 kmlPlace['icon'] = '#marker_icon_'+color_field | 291 kmlPlace['icon'] = '#marker_icon_'+colorField |
292 kmlPlace['coord_x'] = str(xCoord) | 292 kmlPlace['coord_x'] = str(xCoord) |
293 kmlPlace['coord_y'] = str(yCoord) | 293 kmlPlace['coord_y'] = str(yCoord) |
294 kmlPlace['coord_z'] = '0' | 294 kmlPlace['coord_z'] = '0' |
295 if geometry=='poly': | 295 if geomField=='poly': |
296 kmlPlace['LinearRing']=geomdata.split('(')[4] | 296 kmlPlace['LinearRing']=geomdata.split('(')[4] |
297 kmlPlace['LineColor']=color_field | 297 kmlPlace['LineColor']=colorField |
298 kmlData.append(kmlPlace) | 298 kmlData.append(kmlPlace) |
299 | 299 |
300 #logging.debug("kmlData=%s"%(repr(kmlData))) | 300 #logging.debug("kmlData=%s"%(repr(kmlData))) |
301 return kmlData | 301 return kmlData |
302 | 302 |