|
@@ -27,6 +27,10 @@ def get_town_list2(location_list:list,db):
|
|
|
return []
|
|
|
query = []
|
|
|
for location in location_list:
|
|
|
+ if isinstance(location,dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location) #,geometry
|
|
|
query.append(f"ST_Intersects(geometry,ST_PolygonFromText( '{location}', 4326 ))")
|
|
|
query=' or '.join(query)
|
|
@@ -41,6 +45,10 @@ def get_village_list(location_list:list,db,pac=''):
|
|
|
resutl = []
|
|
|
query = []
|
|
|
for location in location_list:
|
|
|
+ if isinstance(location,dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location) #geometry,
|
|
|
query.append(f"ST_Intersects(geometry,ST_PolygonFromText( '{location}', 4326 ))")
|
|
|
query=' or '.join(query)
|
|
@@ -239,6 +247,10 @@ def count_town_village(location_list:list,db):
|
|
|
return result,town_count,village_count
|
|
|
|
|
|
def count_emergency_expert(location_list:list,db):
|
|
|
+ if isinstance(location_list, dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location_list)
|
|
|
|
|
|
sql = text(f"""SELECT * FROM emergency_expert WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326))""")
|
|
@@ -246,7 +258,10 @@ def count_emergency_expert(location_list:list,db):
|
|
|
return len(db.execute(sql).all())
|
|
|
|
|
|
def count_emergency_management(location_list: list, db):
|
|
|
-
|
|
|
+ if isinstance(location_list, dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location_list)
|
|
|
|
|
|
sql = text(f"""SELECT DISTINCT management_unit FROM `rescue_materia` WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326))""")
|
|
@@ -257,6 +272,10 @@ def count_emergency_management(location_list: list, db):
|
|
|
def get_hospital_list(location_list:list,db):
|
|
|
resutl = []
|
|
|
for location in location_list:
|
|
|
+ if isinstance(location,dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location)
|
|
|
sql = text(f"""SELECT hospital_name as `name`,longitude,latitude,6 AS `dataType` FROM mid_hospital WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326))""")
|
|
|
|
|
@@ -267,6 +286,10 @@ def get_emergency_shelter_list(location_list:list,db):
|
|
|
|
|
|
resutl = []
|
|
|
for location in location_list:
|
|
|
+ if isinstance(location,dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location)
|
|
|
|
|
|
sql = text(f"""SELECT shelter_name as `name`,lng as longitude,lat as latitude,3 AS `dataType` FROM mid_emergency_shelter WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', lat, ' ', lng, ')'), 4326))""")
|
|
@@ -279,6 +302,10 @@ def get_waterlogged_roads_list(location_list:list,db):
|
|
|
|
|
|
resutl = []
|
|
|
for location in location_list:
|
|
|
+ if isinstance(location,dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location)
|
|
|
|
|
|
sql = text(f"""SELECT flood_name as `name`,lng as longitude,lat as latitude,4 AS `dataType` FROM mid_waterlogged_roads WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', lat, ' ', lng, ')'), 4326))""")
|
|
@@ -290,6 +317,10 @@ def get_point_list(location_list:list,db):
|
|
|
|
|
|
resutl = []
|
|
|
for location in location_list:
|
|
|
+ if isinstance(location,dict):
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ return []
|
|
|
location = convert_to_polygon(location)
|
|
|
|
|
|
sql = text(f"""SELECT `id` ,`name`, longitude, latitude, `dataType` FROM point_data WHERE ST_Contains(ST_PolygonFromText( '{location}', 4326 ),ST_PointFromText(CONCAT('POINT(', latitude, ' ', longitude, ')'), 4326))""")
|