engine/process.py
def source(self, survey):
        """Return a dictionary containing Web Map specific GeoJSONs
           for both point(s) anb polygon(s) with all data collected by
           all users under a survey."""
        source = {'point': {"type": "FeatureCollection", "name": "Places",
                            "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}},
                            "features": []},
                  'polygon': {"type": "FeatureCollection", "name": "Places",
                              "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}},
                              "features": []}}

        cursor.execute(f"select user_name, entr_time, photo, video, st_astext(point) point, st_astext(polygon), "
                       f"id, survey from {self.db}features where survey = {survey} and ans_check = 1 order by id")
        for row in cursor.fetchall():
            elem = {"user": f"{row[0]}", "time": f"{row[1]}", "photo": f"{row[2]}", "video": f"{row[3]} ",
                    "question": "<br>"}
            if row[3]:
                elem["video"] = f'<a href="{row[3]}">Click the link.</a>'
            if row[2]:
                elem["photo"] = f'<a href="{row[2]}"><img id="Pic" src="{row[2]}"></a>'
            cursor.execute(f"select id, question from {self.db}questions where survey = '{row[7]}' order by id")
            for line in cursor.fetchall():
                cursor.execute(f"select answer from {self.db}answers where q_id = {line[0]} and f_id = {row[6]} ")
                elem["question"] = elem["question"] + f"{line[1]}: {cursor.fetchall()[0][0]}<br>"
            if row[4]:
                source['point']["features"].append({"type": "Feature", "properties": elem,
                                                    "geometry": {"type": "Point", "coordinates": self.point(row[4])}})
            elif row[5]:
                source['polygon']["features"].append({"type": "Feature", "properties": elem,
                                                      "geometry": {"type": "MultiPolygon",
                                                                   "coordinates": [[self.polygon(row[5])]]}})
        return source
Return a dictionary containing Web Map specific GeoJSONs
           for both point(s) anb polygon(s) with all data collected by
           all users under a survey.
Return a dictionary containing Web Map specific GeoJSONs
for both point(s) anb polygon(s) with all data collected by
all users under a survey.
Return a dictionary containing Web Map specific GeoJSONs for both point ( s ) anb polygon ( s ) with all data collected by all users under a survey .
def source(self, survey):
        source = {'point': {"type": "FeatureCollection", "name": "Places",
                            "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}},
                            "features": []},
                  'polygon': {"type": "FeatureCollection", "name": "Places",
                              "crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}},
                              "features": []}}
        cursor.execute(f"select user_name, entr_time, photo, video, st_astext(point) point, st_astext(polygon), "
                       f"id, survey from {self.db}features where survey = {survey} and ans_check = 1 order by id")
        for row in cursor.fetchall():
            elem = {"user": f"{row[0]}", "time": f"{row[1]}", "photo": f"{row[2]}", "video": f"{row[3]} ",
                    "question": "<br>"}
            if row[3]:
                elem["video"] = f'<a href="{row[3]}">Click the link.</a>'
            if row[2]:
                elem["photo"] = f'<a href="{row[2]}"><img id="Pic" src="{row[2]}"></a>'
            cursor.execute(f"select id, question from {self.db}questions where survey = '{row[7]}' order by id")
            for line in cursor.fetchall():
                cursor.execute(f"select answer from {self.db}answers where q_id = {line[0]} and f_id = {row[6]} ")
                elem["question"] = elem["question"] + f"{line[1]}: {cursor.fetchall()[0][0]}<br>"
            if row[4]:
                source['point']["features"].append({"type": "Feature", "properties": elem,
                                                    "geometry": {"type": "Point", "coordinates": self.point(row[4])}})
            elif row[5]:
                source['polygon']["features"].append({"type": "Feature", "properties": elem,
                                                      "geometry": {"type": "MultiPolygon",
                                                                   "coordinates": [[self.polygon(row[5])]]}})
        return source
def source ( self , survey ) : source = { 'point' : { "type" : "FeatureCollection" , "name" : "Places" , "crs" : { "type" : "name" , "properties" : { "name" : "urn:ogc:def:crs:OGC:1.3:CRS84" } } , "features" : [ ] } , 'polygon' : { "type" : "FeatureCollection" , "name" : "Places" , "crs" : { "type" : "name" , "properties" : { "name" : "urn:ogc:def:crs:OGC:1.3:CRS84" } } , "features" : [ ] } } cursor . execute ( f"select user_name, entr_time, photo, video, st_astext(point) point, st_astext(polygon), " f"id, survey from {self.db}features where survey = {survey} and ans_check = 1 order by id" ) for row in cursor . fetchall ( ) : elem = { "user" : f"{row[0]}" , "time" : f"{row[1]}" , "photo" : f"{row[2]}" , "video" : f"{row[3]} " , "question" : "<br>" } if row [ 3 ] : elem [ "video" ] = f'<a href="{row[3]}">Click the link.</a>' if row [ 2 ] : elem [ "photo" ] = f'<a href="{row[2]}"><img id="Pic" src="{row[2]}"></a>' cursor . execute ( f"select id, question from {self.db}questions where survey = '{row[7]}' order by id" ) for line in cursor . fetchall ( ) : cursor . execute ( f"select answer from {self.db}answers where q_id = {line[0]} and f_id = {row[6]} " ) elem [ "question" ] = elem [ "question" ] + f"{line[1]}: {cursor.fetchall()[0][0]}<br>" if row [ 4 ] : source [ 'point' ] [ "features" ] . append ( { "type" : "Feature" , "properties" : elem , "geometry" : { "type" : "Point" , "coordinates" : self . point ( row [ 4 ] ) } } ) elif row [ 5 ] : source [ 'polygon' ] [ "features" ] . append ( { "type" : "Feature" , "properties" : elem , "geometry" : { "type" : "MultiPolygon" , "coordinates" : [ [ self . polygon ( row [ 5 ] ) ] ] } } ) return source
Return a dictionary containing Web Map specific GeoJSONs
for both point(s) anb polygon(s) with all data collected by
all users under a survey.
Return a dictionary containing Web Map specific GeoJSONs for both point ( s ) anb polygon ( s ) with all data collected by all users under a survey .
"""Return a dictionary containing Web Map specific GeoJSONs
           for both point(s) anb polygon(s) with all data collected by
           all users under a survey."""
self
survey