def get_png(self, queryset): if isinstance(queryset, GEOSGeometry): wkt = queryset.wkt geom_type = queryset.geom_type else: wkt = queryset.geom.wkt geom_type = queryset.geom.geom_type builder_png = BuilderPNG({'wkt': wkt, 'type': geom_type}) return builder_png.generate()
def get_png(self, queryset): wkt = "GEOMETRYCOLLECTION(" for i,e in enumerate(queryset): wkt += e.geom.wkt #it is need to fix the case that the attribute is not called by geom if i != len(queryset)-1: wkt += "," else: wkt += ")" geom_type = queryset[0].geom.geom_type builder_png = BuilderPNG({'wkt': wkt, 'type': geom_type}) return builder_png.generate()