def find_by_sgg_cd(cls, sgg_cd): return db.session.query(cls.emd_cd, cls.emd_ko_nm, func.ST_AsGeoJSON(func.ST_Centroid(cls.geom)).label('geojson')). \ filter(cls.emd_cd.like('{0}%'.format(sgg_cd))). \ order_by(cls.emd_cd.asc()).all()
def find_all(cls): return db.session.query(cls.sid_cd, cls.sid_ko_nm, func.ST_AsGeoJSON(func.ST_Centroid(cls.geom)).label('geojson')). \ order_by(cls.sid_cd.asc()).all()
def find_by_identity(cls, identity): return db.session.query(cls.emd_cd, cls.emd_ko_nm, func.ST_AsGeoJSON(func.ST_Centroid(cls.geom)).label('geojson')). \ filter(cls.emd_cd == identity).first()
def center_point(self): return Point( geo=db.session.query(functions.ST_Centroid(self.geo)).first()[0])