<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Get  Lat and Lon of all location that are withing 1km radius of my current location through MySQL]]></title><description><![CDATA[<p dir="auto">Hi, I want to get locations table rows, that are withing 1km radius of my current location.</p>
<pre><code>CREATE TABLE `locations` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `lat` double NOT NULL,
  `lng` double NOT NULL,
  `user_id` int(11) unsigned NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
</code></pre>
]]></description><link>https://lankadevelopers.lk/topic/193/get-lat-and-lon-of-all-location-that-are-withing-1km-radius-of-my-current-location-through-mysql</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 04:35:53 GMT</lastBuildDate><atom:link href="https://lankadevelopers.lk/topic/193.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 25 Mar 2019 08:19:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Get  Lat and Lon of all location that are withing 1km radius of my current location through MySQL on Mon, 25 Mar 2019 10:54:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/2">@dev_lak</a></p>
<p dir="auto">Wow. it's working</p>
]]></description><link>https://lankadevelopers.lk/post/1270</link><guid isPermaLink="true">https://lankadevelopers.lk/post/1270</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Mon, 25 Mar 2019 10:54:20 GMT</pubDate></item><item><title><![CDATA[Reply to Get  Lat and Lon of all location that are withing 1km radius of my current location through MySQL on Mon, 25 Mar 2019 08:29:46 GMT]]></title><description><![CDATA[<p dir="auto">Hi, try below query, replace <code>YOUR_LAT</code> and <code>YOUR_LNG</code> with your current position and change <code>DISTANCE_IN_MILE</code> as you required</p>
<pre><code>select * from locations where lat!='' and lng!='' and ( 3959 * acos( cos( radians(YOUR_LAT) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(YOUR_LNG) ) + sin( radians(YOUR_LAT) ) * sin( radians( lat ) ) ) ) &lt; DISTANCE_IN_MILE
</code></pre>
]]></description><link>https://lankadevelopers.lk/post/1269</link><guid isPermaLink="true">https://lankadevelopers.lk/post/1269</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Mon, 25 Mar 2019 08:29:46 GMT</pubDate></item></channel></rss>