Mercurial > hg > ChinaGisRestApi
changeset 126:89386036e661
polygon-Layers
author | fknauft |
---|---|
date | Wed, 02 Feb 2011 14:41:24 +0100 |
parents | 1a7121259942 |
children | 7ed8de30af56 |
files | RestDbGisApi.py zpt/KML_schema_table.zpt |
diffstat | 2 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/RestDbGisApi.py Wed Feb 02 14:28:28 2011 +0100 +++ b/RestDbGisApi.py Wed Feb 02 14:41:24 2011 +0100 @@ -161,7 +161,7 @@ paramstr = urllib.urlencode(params) return "%s/db/%s/%s?%s"%(baseUrl,schema,table,paramstr) - def getKmlData(self, schema, table, ids=None, sortBy=1, gisIdField=None, latField=None, lonField=None, geometry="point"): + def getKmlData(self, schema, table, ids=None, sortBy=1, gisIdField=None, latField=None, lonField=None, geometry="point", color_field="red"): """returns data structure for KML template""" logging.debug("getKMLdata gid=%s lat=%s lon=%s"%(gisIdField,latField,lonField)) # Mapping a set of points from table-based SQL-query: @@ -286,8 +286,6 @@ #kmlPlace['description'] = "<![CDATA[%s]]>"%desc kmlPlace['description'] = desc - try: color_field - except: color_field="red" if geometry=='point': kmlPlace['icon'] = '#marker_icon_'+color_field
--- a/zpt/KML_schema_table.zpt Wed Feb 02 14:28:28 2011 +0100 +++ b/zpt/KML_schema_table.zpt Wed Feb 02 14:41:24 2011 +0100 @@ -1,10 +1,10 @@ <?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',None); - latField python:request.get('lat_field',None); lonField python:request.get('lon_field',None); + latField python:request.get('lat_field',None); lonField python:request.get('lon_field',None); geomField python:request.get('geometry_field',None); sortBy python:request.get('sort_field',1); schema options/schema; table options/table; - data python:here.getKmlData(schema=schema,table=table,sortBy=sortBy,gisIdField=gisIdField,latField=latField,lonField=lonField); + data python:here.getKmlData(schema=schema,table=table,sortBy=sortBy,gisIdField=gisIdField,latField=latField,lonField=lonField,geomField=geomField,colorField=colorField ); withLine python:request.get('connect_line',None);"> <Document> <Style id="marker_icon_red"> @@ -72,7 +72,7 @@ </Point> <Style tal:condition="place/LinearRing"> <PolyStyle><color tal:content="place/LineColor">#80800000</color><fill>1</fill><outline>1</outline></PolyStyle></Style> - <MultiGeometry tal:condition="place/LinearRing"><Polygon><outerBoundaryIs><LinearRing><coordinates> tal:content="string:${place/LinearRing}">116.38,39.92,0</coordinates> + <MultiGeometry tal:condition="place/LinearRing"><Polygon><outerBoundaryIs><LinearRing><coordinates tal:content="string:${place/LinearRing}">116.38,39.92,0</coordinates> </LinearRing></outerBoundaryIs></Polygon></MultiGeometry> </Placemark> <Placemark tal:condition="withLine">