def fillFeatureMemberLine(self, fID, vertices, dbfValues): gml_point = [] fml_a = gml_point.append fml_a('\n<gml:featureMember>') fml_a('<reportnet fid="%s">' % fID) fml_a('<geometryProperty>') if len(vertices) == 1: fml_a('<gml:LineString>') l_vtoadd = "" for k in range (len(vertices)): for j in (vertices[k]): l_vtoadd = l_vtoadd + ('%s,%s ' % (j[0],j[1])) fml_a('<gml:coordinates>%s</gml:coordinates>' % strip(l_vtoadd)) fml_a('</gml:LineString>') elif len(vertices) > 1: fml_a('<gml:MultiLineString>') for k in range (len(vertices)): fml_a('<gml:lineStringMember>') fml_a('<gml:LineString>') l_vmtoadd = "" for j in (vertices[k]): l_vmtoadd = l_vmtoadd +('%s,%s ' % (j[0],j[1])) fml_a('<gml:coordinates>%s</gml:coordinates>' % strip(l_vmtoadd)) fml_a('</gml:LineString>') fml_a('</gml:lineStringMember>') fml_a('</gml:MultiLineString>') fml_a('</geometryProperty>') for k,v in (dbfValues.items()): fml_a('<%s>%s</%s>' % (utGMLEncode(k, self.__user_enc), utGMLEncode(v, self.__user_enc), utGMLEncode(k, self.__user_enc))) fml_a('</reportnet>') fml_a('</gml:featureMember>') return '\n'.join(gml_point)
def fillFeatureMemberPoint(self, fID, X, Y, dbfValues): gml_point = [] fmp_a = gml_point.append fmp_a('\n<gml:featureMember>') fmp_a('<reportnet fid="%s">' % fID) fmp_a('<geometryProperty>') fmp_a('<gml:Point>') fmp_a('<gml:coordinates>%s,%s</gml:coordinates>' % (X,Y)) fmp_a('</gml:Point>') fmp_a('</geometryProperty>') for k,v in (dbfValues.items()): fmp_a('<%s>%s</%s>' % (utGMLEncode(k, self.__user_enc), utGMLEncode(v, self.__user_enc), utGMLEncode(k, self.__user_enc))) fmp_a('</reportnet>') fmp_a('</gml:featureMember>') return '\n'.join(gml_point)
def fillFeatureMemberPolygon(self, fID, vertices, dbfValues): gml_polygon = [] fmpl_a = gml_polygon.append fmpl_a('\n<gml:featureMember>') fmpl_a('<reportnet fid="%s">' % fID) fmpl_a('<geometryProperty>') if len(vertices) == 1: fmpl_a('<gml:Polygon>') fmpl_a('<gml:outerBoundaryIs>') fmpl_a('<gml:LinearRing>') l_vtoadd = "" for vert in vertices[0]: l_vtoadd = l_vtoadd+ ('%s,%s ' % (vert[0], vert[1])) fmpl_a('<gml:coordinates>%s</gml:coordinates>' % strip(l_vtoadd)) fmpl_a('</gml:LinearRing>') fmpl_a('</gml:outerBoundaryIs>') fmpl_a('</gml:Polygon>') elif len(vertices) > 1: fmpl_a('<gml:MultiPolygon>') for k in range (len(vertices)): fmpl_a('<gml:polygonMember>') fmpl_a('<gml:Polygon>') fmpl_a('<gml:outerBoundaryIs>') fmpl_a('<gml:LinearRing>') l_vmtoadd = "" for j in (vertices[k]): l_vmtoadd = l_vmtoadd +('%s,%s ' % (j[0],j[1])) fmpl_a('<gml:coordinates>%s</gml:coordinates>' % strip(l_vmtoadd)) fmpl_a('</gml:LinearRing>') fmpl_a('</gml:outerBoundaryIs>') fmpl_a('</gml:Polygon>') fmpl_a('</gml:polygonMember>') fmpl_a('</gml:MultiPolygon>') fmpl_a('</geometryProperty>') for k,v in (dbfValues.items()): fmpl_a('<%s>%s</%s>' % (utGMLEncode(k, self.__user_enc), utGMLEncode(v, self.__user_enc), utGMLEncode(k, self.__user_enc))) fmpl_a('</reportnet>') fmpl_a('</gml:featureMember>') return '\n'.join(gml_polygon)
def fillMetadata(self, val, filename): gml_meta = [] fmp_a = gml_meta.append fmp_a('\n<met:info href="%s.gml">' % (filename)) fmp_a(METADATA_TEMPLATE % (utGMLEncode(val['met:organisationName'], self.__user_enc), \ utGMLEncode(val['met:owncontactPerson'], self.__user_enc), \ utGMLEncode(val['met:addressDeliveryPoint'], self.__user_enc), \ utGMLEncode(val['met:addressCity'], self.__user_enc), \ utGMLEncode(val['met:addressPostalCode'], self.__user_enc), \ utGMLEncode(val['met:addressCountry'], self.__user_enc), \ utGMLEncode(val['met:ownaddressEmail'], self.__user_enc), \ utGMLEncode(val['met:ownaddressWebSite'], self.__user_enc), \ utGMLEncode(val['met:title'], self.__user_enc), \ utGMLEncode(val['met:footnote'], self.__user_enc), \ utGMLEncode(val['met:briefAbstract'], self.__user_enc), \ utGMLEncode(val['met:keywords'], self.__user_enc), \ utGMLEncode(val['met:referenceDate'], self.__user_enc), \ utGMLEncode(val['met:mapinreports'], self.__user_enc), \ utGMLEncode(val['met:maponweb'], self.__user_enc), \ utGMLEncode(val['met:desc'], self.__user_enc), \ utGMLEncode(val['met:name'], self.__user_enc), \ utGMLEncode(val['met:organisation'], self.__user_enc), \ utGMLEncode(val['met:contactPerson'], self.__user_enc), \ utGMLEncode(val['met:addressEmail'], self.__user_enc), \ utGMLEncode(val['met:addressWebSite'], self.__user_enc), \ utGMLEncode(val['met:productionYear'], self.__user_enc), \ utGMLEncode(val['met:url'], self.__user_enc), \ utGMLEncode(val['met:otherRelevantInfo'], self.__user_enc))) return '\n'.join(gml_meta)
def fillProjection(self, val): gml_prj = [] pr_a = gml_prj.append pr_a(PROJECTION_TEMPLATE % utGMLEncode(val, self.__user_enc)) return '\n'.join(gml_prj)
def fillExportMetadata(self, val, filename): gml_meta = [] fmp_a = gml_meta.append fmp_a('<?xml version="1.0" encoding="UTF-8"?>') fmp_a('<met:info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') fmp_a('xmlns:met="http://biodiversity.eionet.europa.eu/schemas/dir9243eec"') fmp_a('xsi:schemaLocation="http://biodiversity.eionet.europa.eu/schemas/dir9243eec http://biodiversity.eionet.europa.eu/schemas/dir9243eec/gml_art17_meta.xsd" href="%s.gml">' % (filename)) fmp_a(METADATA_TEMPLATE % (utGMLEncode(val['met:organisationName'], self.__user_enc), \ utGMLEncode(val['met:owncontactPerson'], self.__user_enc), \ utGMLEncode(val['met:addressDeliveryPoint'], self.__user_enc), \ utGMLEncode(val['met:addressCity'], self.__user_enc), \ utGMLEncode(val['met:addressPostalCode'], self.__user_enc), \ utGMLEncode(val['met:addressCountry'], self.__user_enc), \ utGMLEncode(val['met:ownaddressEmail'], self.__user_enc), \ utGMLEncode(val['met:ownaddressWebSite'], self.__user_enc), \ utGMLEncode(val['met:title'], self.__user_enc), \ utGMLEncode(val['met:footnote'], self.__user_enc), \ utGMLEncode(val['met:briefAbstract'], self.__user_enc), \ utGMLEncode(val['met:keywords'], self.__user_enc), \ utGMLEncode(val['met:referenceDate'], self.__user_enc), \ utGMLEncode(val['met:mapinreports'], self.__user_enc), \ utGMLEncode(val['met:maponweb'], self.__user_enc), \ utGMLEncode(val['met:desc'], self.__user_enc), \ utGMLEncode(val['met:name'], self.__user_enc), \ utGMLEncode(val['met:organisation'], self.__user_enc), \ utGMLEncode(val['met:contactPerson'], self.__user_enc), \ utGMLEncode(val['met:addressEmail'], self.__user_enc), \ utGMLEncode(val['met:addressWebSite'], self.__user_enc), \ utGMLEncode(val['met:productionYear'], self.__user_enc), \ utGMLEncode(val['met:url'], self.__user_enc), \ utGMLEncode(val['met:otherRelevantInfo'], self.__user_enc))) fmp_a('</met:info>') return '\n'.join(gml_meta)