Ep

Ep

How to get points inside circle? - Google Maps v3

How to show points within circle on Google Map API v3 in a Query


In my previous post I explained Circle Draw with a Radius Google Maps v3. Here I will explain how to get points inside circle. Find MySQL query mentioned below.

  • Find if points are within a circle with given center and radius

SELECT COUNT(*) FROM (SELECT (6371 * ACOS( COS( RADIANS('22.607672') ) * COS( RADIANS( Latitude ) ) * COS( RADIANS( Longitude ) - RADIANS('88.36853') ) + SIN( RADIANS('22.607672') ) * SIN( RADIANS( Latitude ) ) ) )   AS distance FROM bts HAVING distance < '7') a


  • Query points within a given radius in MySQL
SELECT Latitude,Longitude FROM  (SELECT Latitude,Longitude,(6371 * ACOS( COS( RADIANS('22.607672') ) * COS( RADIANS( Latitude ) ) * COS( RADIANS( Longitude ) - RADIANS('88.36853') ) + SIN( RADIANS('22.607672') )* SIN( RADIANS( Latitude ) ) ) )   AS distance FROM bts HAVING distance < '7') a

In a Query MySQL

How to get points inside circle? - Google Maps v3



How to get points inside circle? - Google Maps v3 Reviewed by Ravi Kumar on 12:11:00 PM Rating: 5

2 comments:

  1. Thanks a lot for this, could you also give the structure of the MySQL table here as I presume the type of fields will be important here for running this query?

    Thanks,
    Alind

    ReplyDelete
  2. your welcome and thank you for your time!

    ya sure! there are following columns in MySQL table;-
    Sno,BTS_ID,BTS_NAME,BTS_ADD,Latitude,Longitude,BTS_NODE_B_id,isActive

    ReplyDelete

All Rights Reserved by Etechpulse © 2012 - 2017
Powered By Blogger

Contact Form

Name

Email *

Message *

Powered by Blogger.