Yes, you cannot use radius and rankBy in same request. But you can use rankBy=distance
and then count distance youself based on geometry.location.lat
and geometry.location.lng
. For exmaple in groovy i've done like that:
GeoPosition
and Place
classes are implemented by me, so don't expect to find them at the core libs :)
TreeMap<Double, Place> nearbyPlaces = new TreeMap<Double, Place>()
if(isStatusOk(nearbySearchResponse))
nearbySearchResponse.results.each {
def location = it.geometry.location
String placeid = it.place_id
GeoPosition position = new GeoPosition(latitude: location.lat,
longitude: location.lng)
Place place = new Place(position)
double distance = distanceTo(place)
//If the place is actually in your radius (because Places API oftenly returns places far beyond your radius) then you add it to the TreeMap with distance to it as a key, and it will automatically sort it for you.
if((distance <= placeSearcher.Radius()))
nearbyPlaces.put(distance, place)
}
where distance is counted like that (Haversine formula):
public double distanceTo(GeoPosition anotherPos){
int EARTH_RADIUS_KM = 6371;
double lat1Rad = Math.toRadians(this.latitude);
double lat2Rad = Math.toRadians(anotherPos.latitude);
double deltaLonRad = Math.toRadians(anotherPos.longitude - this.longitude);
return 1000*Math.acos(
Math.sin(lat1Rad) * Math.sin(lat2Rad) +
Math.cos(lat1Rad) * Math.cos(lat2Rad) * Math.cos(deltaLonRad)
) * EARTH_RADIUS_KM;
}
You should not run Oracle as root user, it's a security risk. There is not a single reason to run the rdbms and/or the listener as root user, unless you completely messed up the installation, that also is not even allowed to run as root.
If you do feel a need to run the listener as root user, make sure that your environment variables are correct. In your case:
# export ORACLE_HOME=/opt/oracle/102
# export PATH=$PATH:$ORACLE_HOME/bin
# cd $ORACLE_HOME/bin
# chmod u+s lsnrctl
# lsnrctl start
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 09-MAY-2012 20:51:07
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /data/oracle/base/product/se_10205_s/bin/tnslsnr: please
wait...
TNSLSNR for Linux: Version 10.2.0.5.0 - Production System parameter
file is /data/oracle/base/admin/network/listener.ora Log messages
written to
/data/oracle/base/product/se_10205_s/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production Start Date
09-MAY-2012 20:51:09 Uptime 0 days 0 hr. 0 min. 0
sec Trace Level off Security ON: Local
OS Authentication SNMP OFF Listener Parameter
File /data/oracle/base/admin/network/listener.ora Listener Log File
/data/oracle/base/product/se_10205_s/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) The listener
supports no services The command completed successfully
# lsnrctl stop
LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 09-MAY-2012
20:52:16
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
TNS-01190: The user is not authorized to execute the requested
listener command
Don't do this; if you do you make a mistake. Pick any other user that is member of the dba group but not root.
BTW: after this little demo I had to fix a little issue:
Started with pid=5215 Error listening on:
(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) TNS-12555:
TNS:permission denied TNS-12560: TNS:protocol adapter error
TNS-00525: Insufficient privilege for operation Linux Error: 1:
Operation not permitted
problem was - obvious - that /var/tmp/.oracle/sLISTENER was owned by root. A little chown to the correct user took care of that.
Best Answer
Simply put nearby places allows you to search more vaguely but only return specific results. In Text Search, if you search for "restaurants", it will search for locations, establishments or names with the text "restaurants".Anything that is related to restaurants. Meanwhile in nearby search, if you search for "restaurants", it will return restaurant establishments with or without the text "restaurants" but only establishments of "restaurants"