Sinscary
Sinscary

Reputation: 692

How to find all points in a radius in sqlalchemy

I am working on a project where i am using Flask, sqlalchemy and postgres. I am having three columns in my table, name, lat, lng. Now what i want is when a user sends a get request on api with location name, it should return all the locations from database which are in a certain radius to the city for e.g. say in 5 KM radius. I have already seen this answer. but its not what i want and also i am not getting how do i use earth_box and earthdistance with sqlalchemy. Please help.

Upvotes: 0

Views: 359

Answers (1)

user7495107
user7495107

Reputation:

You can use select geom st_within st_buffer(geom,radius) functions in postgis extension of postgresql

Upvotes: 1

Related Questions