This discussion is archived
1 Reply Latest reply: May 1, 2013 2:28 PM by NoelKhan RSS

Cities Near By

293445 Explorer
Currently Being Moderated
Hi,
We are developing a mobile app using ADF Mobile. One of the requirement is to display a map and mark the field employees in the surrounding locations, lets say within 20 miles radius. We are using Oracle Map Viewer as maps. Now, we are looking for any API that takes current lat, lng, radius, and return the near by places (towns/cities)? something equivalent to this: http://api.geonames.org/findNearbyPlaceNameJSON?lat=37.53195483966782&lng=-122.26193971893862&radius=20&username=demo

Thanks
Srini
  • 1. Re: Cities Near By
    NoelKhan Journeyer
    Currently Being Moderated
    Srini,

    Use [ SDO_WITHIN_DISTANCE | http://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_operat.htm#i77653 ] to find nearby employees. That function requires a centerpoint, which you can create using the SDO_GEOMETRY constructor. For example
    SELECT
         EmployeeID
    FROM 
         EmployeeLocations               -- "<-- Your tableName here"
    WHERE
         SDO_WITHIN_DISTANCE(
              geometry,                -- "<-- your geometryColumnName here"
              SDO_GEOMETRY(2001,
                   40986,                -- "<-- your SRID here"
                   SDO_POINT_TYPE(
                        6000000,     -- "<-- Center point of circle"
                        2100000,     -- "... your employees are in"
                        0
                   ),NULL,NULL
              ),
              'distance=20 unit=MILE'
         ) = 'TRUE'
    ;
    Regards,
    Noel

    Edited by: Noel Khan on May 1, 2013 2:25 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points