near distance using buffer intersection
This commit is contained in:
parent
48a18584c3
commit
0537b09e47
1 changed files with 1 additions and 1 deletions
|
@ -77,7 +77,7 @@ class EventResource(object):
|
|||
event_dist = ""
|
||||
elif 'near' in req.params:
|
||||
# limit search with location+distance (long, lat, distance in meters)
|
||||
event_bbox = cur.mogrify(" AND geom && st_expand(st_buffer(st_setsrid(st_makepoint(%s,%s),4326)::geography,%s)::geometry,0) ",tuple(req.params['near'])).decode("utf-8")
|
||||
event_bbox = cur.mogrify(" AND ST_Intersects(geom, ST_Buffer(st_setsrid(st_makepoint(%s,%s),4326)::geography,%s)::geometry) ",tuple(req.params['near'])).decode("utf-8")
|
||||
event_dist = cur.mogrify(", 'distance', ST_Length(ST_ShortestLine(geom, st_setsrid(st_makepoint(%s,%s),4326))::geography) ",(req.params['near'][0], req.params['near'][1])).decode("utf-8")
|
||||
else:
|
||||
event_bbox = ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue