Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nearest places from a certain point

I have the following table

create table places(lat_lng point, place_name varchar(50));

insert into places values (POINT(-126.4, 45.32), 'Food Bar');

What should be the query to get all places close to particular lat/long?

gis is installed.

like image 771
kapso Avatar asked Sep 28 '12 17:09

kapso


1 Answers

select *
from places
where lat_lng <-> POINT(-125.4, 46.32) < 1
order by lat_lng <-> POINT(-125.4, 46.32)
like image 189
Clodoaldo Neto Avatar answered Sep 25 '22 22:09

Clodoaldo Neto