Răsfoiți Sursa

根据poi选址

gushoubang 6 luni în urmă
părinte
comite
ebc71a5c7f

BIN
app/__pycache__/__init__.cpython-310.pyc


BIN
app/__pycache__/routes.cpython-310.pyc


BIN
app/services/__pycache__/__init__.cpython-310.pyc


BIN
app/services/__pycache__/chat_service.cpython-310.pyc


BIN
app/services/__pycache__/file_service.cpython-310.pyc


+ 17 - 7
app/services/chat_service.py

@@ -37,8 +37,8 @@ factors是因子选择
     "buffer": 500,
     "landType": "居住用地",
     "area": {
-        "min": 30,
-        "max": 50
+        "min": 10,
+        "max": 100
     },
     "factors": [
         {
@@ -122,7 +122,7 @@ def create_chat(msg, type):
                 poi = json_res["poi"]
                 # if landType != "未找到相关数据" and landType != "" and districtName  != "未找到相关数据"and districtName != "":
 
-                if landType in land and districtName in addtress:
+                if landType in land and( districtName in addtress or poi!=""):
                     json_res = jsonResToDict(json_res, poi)
                     # print(json_res)
                 else:
@@ -315,11 +315,21 @@ def getAiDistrict(name):
 
 def getPoiArea(name, buffer):
     with conn.cursor(cursor_factory=DictCursor) as cur:
-        sql = "SELECT public.st_asewkt(geom) as geom FROM base.t_fzss_fzxz_ai_district WHERE name = %s"
-        sql="SELECT public.st_asewkt(public.st_buffer(geom::public.geography,%s)) FROM vector.poi WHERE name like '%%s%'"
-        complete_sql = cur.mogrify(sql, (name,buffer,)).decode('utf-8')
+        # SQL query with LIKE and buffer
+        sql = """
+        SELECT public.st_asewkt(public.st_buffer(geom::public.geography, %s)) as geom 
+        FROM vector.poi 
+        WHERE name LIKE %s
+        """
+        # Use % for LIKE query, adding % around the name parameter
+        like_name = f"%{name}%"
+        
+        # Format the query
+        complete_sql = cur.mogrify(sql, (buffer, like_name)).decode('utf-8')
         logger.info(f"Executing SQL: {complete_sql}")
-        cur.execute(sql, (name,buffer,))
+        
+        # Execute the query
+        cur.execute(sql, (buffer, like_name))
         res = cur.fetchone()
     return res["geom"]
 

BIN
app/utils/__pycache__/__init__.cpython-310.pyc


BIN
app/utils/__pycache__/pinyin_utils.cpython-310.pyc