Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Question Unanswered: Need help in GEO query

    -----
    SELECT * , 3956 *2 * ASIN( SQRT( POWER( SIN( ( 122.4058 - ABS( dest.lat ) ) * PI( ) /180 /2 ) , 2 ) + COS( 122.4058 * PI( ) /180 ) * COS( ABS( dest.lat ) * PI( ) /180 ) * POWER( SIN( ( 37.7907 - dest.lon ) * PI( ) /180 /2 ) , 2 ) ) ) AS distance
    FROM members dest
    HAVING distance <25

    Above query run perfectly .. Users will have one field name search_distance .. So i want to calculate users location and current location distance based in search_distance ..

    Please help me to solve this ! Let me know if this is not clear


    User Table have below fields
    id, user_name, lat, lon, search_distance

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    This is not clear. If you are looking for assistance in rewriting the formula or a problem with the database/SQL?
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  3. #3
    Join Date
    Dec 2011
    Posts
    2
    Yes, I need help rewrite query ..This query will search lat,lon inside 25km redius from current location ...

    Now I want to add constraint .. Based on searched lat,lon list i want to calculate current location's distance..
    Let me know if still not clear ..
    Last edited by mavrick4sky; 12-22-11 at 07:40.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •