如何找到从 MySQL 返回的匹配坐标,坐标是二进制形式的?
因为latitude 值不正确而无法正常工作的代码是
conn = pymysql.connect(
host=endpoint,
user=username,
password=password,
port=port,
database=database
)
cursor = conn.cursor()
query = """
SELECT uuid, ERASEnabled, useractivity
FROM algoData
WHERE gender = %s
AND dob BETWEEN %s AND %s
AND ST_Distance_Sphere(location, ST_PointFromText(%s)) / 1609.34 <= %s
LIMIT %s;
"""
limit = 5000
parameters = (
lookingFor,
min_date_string,
max_date_string,
formattedCoordinatesForSQLUse,
maxDistance,
limit,
)
用于检索所有二进制位置点的代码是
conn = pymysql.connect(
host=endpoint,
user=username,
password=password,
port=port,
database=database
)
cursor = conn.cursor()
read_command = """
SELECT *
FROM algoData
"""
cursor.execute(read_command)
results = cursor.fetchall()
uuids = [result[0] for result in results]
locationPoints = [result[3] for result in results]
locationPoints = [str(point) for point in locationPoints]
列描述为 ('location', 'point', 'NO', 'MUL', None, '')