engine/process.py
def adjust(self, survey, point_extent, polygon_extent):
        """Return the spatially adjusted area, encompassing all collected
           by all users geometries under a survey"""
        adjust = {}

        if point_extent is not None and polygon_extent is not None:
            cursor.execute(f'select st_extent((select st_union((select st_setsrid(st_extent(point), 4326) '
                           f'from {self.db}features where survey = {survey} and ans_check = 1),'
                           f'(select st_setsrid(st_extent(polygon), 4326) '
                           f'from {self.db}features where survey = {survey} and ans_check = 1))))')
            adjust = self.map_center(cursor.fetchall()[0][0][4:-1].split(','))
        elif point_extent is not None and polygon_extent is None:
            cursor.execute(f'select st_extent(point) from {self.db}features where survey = {survey} and ans_check = 1')
            adjust = self.map_center(cursor.fetchall()[0][0][4:-1].split(','))
        elif point_extent is None and polygon_extent is not None:
            cursor.execute(f'select st_extent(polygon) from {self.db}features where survey = {survey} and '
                           f'ans_check = 1')
            adjust = self.map_center(cursor.fetchall()[0][0][4:-1].split(','))

        return adjust
Return the spatially adjusted area, encompassing all collected
           by all users geometries under a survey
Return the spatially adjusted area, encompassing all collected
by all users geometries under a survey
Return the spatially adjusted area encompassing all collected by all users geometries under a survey
def adjust(self, survey, point_extent, polygon_extent):
        adjust = {}
        if point_extent is not None and polygon_extent is not None:
            cursor.execute(f'select st_extent((select st_union((select st_setsrid(st_extent(point), 4326) '
                           f'from {self.db}features where survey = {survey} and ans_check = 1),'
                           f'(select st_setsrid(st_extent(polygon), 4326) '
                           f'from {self.db}features where survey = {survey} and ans_check = 1))))')
            adjust = self.map_center(cursor.fetchall()[0][0][4:-1].split(','))
        elif point_extent is not None and polygon_extent is None:
            cursor.execute(f'select st_extent(point) from {self.db}features where survey = {survey} and ans_check = 1')
            adjust = self.map_center(cursor.fetchall()[0][0][4:-1].split(','))
        elif point_extent is None and polygon_extent is not None:
            cursor.execute(f'select st_extent(polygon) from {self.db}features where survey = {survey} and '
                           f'ans_check = 1')
            adjust = self.map_center(cursor.fetchall()[0][0][4:-1].split(','))
        return adjust
def adjust ( self , survey , point_extent , polygon_extent ) : adjust = { } if point_extent is not None and polygon_extent is not None : cursor . execute ( f'select st_extent((select st_union((select st_setsrid(st_extent(point), 4326) ' f'from {self.db}features where survey = {survey} and ans_check = 1),' f'(select st_setsrid(st_extent(polygon), 4326) ' f'from {self.db}features where survey = {survey} and ans_check = 1))))' ) adjust = self . map_center ( cursor . fetchall ( ) [ 0 ] [ 0 ] [ 4 : - 1 ] . split ( ',' ) ) elif point_extent is not None and polygon_extent is None : cursor . execute ( f'select st_extent(point) from {self.db}features where survey = {survey} and ans_check = 1' ) adjust = self . map_center ( cursor . fetchall ( ) [ 0 ] [ 0 ] [ 4 : - 1 ] . split ( ',' ) ) elif point_extent is None and polygon_extent is not None : cursor . execute ( f'select st_extent(polygon) from {self.db}features where survey = {survey} and ' f'ans_check = 1' ) adjust = self . map_center ( cursor . fetchall ( ) [ 0 ] [ 0 ] [ 4 : - 1 ] . split ( ',' ) ) return adjust
Return the spatially adjusted area, encompassing all collected
by all users geometries under a survey
Return the spatially adjusted area encompassing all collected by all users geometries under a survey
"""Return the spatially adjusted area, encompassing all collected
           by all users geometries under a survey"""
self
survey
point_extent
polygon_extent