I have the following example (adapted from the PostGIS manual (version 2.2):
CREATE TABLE global_points (
id SERIAL PRIMARY KEY,
name VARCHAR(64),
location GEOGRAPHY(POINT,4326)
);
INSERT INTO global_points (name, location) VALUES ('London', ST_GeographyFromText('SRID=4326;POINT(0 49)') );
INSERT ..........
c = conn.cursor()
try:
query ="SELECT name FROM global_points WHERE ST_DWithin(location, ST_GeographyFromText('SRID=4326;POINT(-110 29)'), 1000000);"
c.execute(query)
l = c.fetchall()
................. How shall I modify the query to allow for specifiyng the variables lon and lat in POINT in order to be able to iterate over a set of geographic locations?