This discussion is archived
1 Reply Latest reply: May 1, 2013 1:53 PM by jsharma RSS

places 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: places near by
    jsharma Pro
    Currently Being Moderated
    Am trying to understand the requirement and its relation to the question.
    The requirement is to find and display employees in surrounding locations, correct?

    If you're using an Oracle database those employees could just as easily have an associated location (Long, Lat) in addition to an address.
    In which case it's just a sql query to get employees within 20 miles of specified (long, lat)

    e.g.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options

    SQL> desc customers
    Name Null? Type
    ----------------------------------------- -------- ----------------------------

    NAME VARCHAR2(64 CHAR)
    CITY VARCHAR2(64 CHAR)
    COUNTY VARCHAR2(64 CHAR)
    STATE VARCHAR2(64 CHAR)
    LOCATION MDSYS.SDO_GEOMETRY
    SALES NUMBER

    SQL> select name, sales from customers where sdo_within_distance(location,
    2 sdo_geometry(2001, 8307, sdo_point_type(-122.2618397189, 37.531954839,null),
    3 null, null), 'distance=20 unit=mile')='TRUE';

    NAME SALES
    ---------------------------------------------------------------- ----------
    STRAWFLOWERS SHOPPING CENTER 71.9
    SERRAMONTE SHOPPING CENTER 54.1
    WESTLAKE SHOPPING CENTER 115.2
    STONESTOWN GALLERIA 34
    FOX MALL 55.9
    CARLMONT VILLAGE SHOPPING CENTER 199.4
    JAPAN CENTER 98.5
    FOX PLAZA 74.6
    SIX SIXTY CENTER 49.4
    CITY LIGHTS BOOKSTORE 145.7
    FHS INVESTMENTS LLC 106.2
    ... etc

    The customers nearby itself can be just a MapViewer predefined theme with a bind variable for current location and distance and optionally distance unit.
    SQL> select styling_rules from user_sdo_themes where name='CUSTOMERS_NEARBY';
    STYLING_RULES
    --------------------------------------------------------------------------------

    <?xml version="1.0" standalone="yes"?>
    <styling_rules>
    <hidden_info>
    <field column="SALES" name="Sales"/>
    <field column="CITY" name="City"/>
    </hidden_info>
    <rule>
    <features asis="true" style="M.CIRCLE_11_GRBU_3"> (sdo_within_distance(location, :1, :2)='TRUE')
    </features>
    </rule>
    </styling_rules>


    SQL>

    If the above is not what you're really trying to do and all you want is a list of places nearby via a web service then the geonames service you mention is one option.
    The question then is what do you want to do with the list of placenames? Use them in a query to find employees in those cities?

Legend

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