GPS coordinates within certain radius based on current location

by Martijn van der Plaat » Fri, 04 Sep 2009 01:44:37 GMT


Sponsored Links
 Dear all,

In my application I have a list of +400 GPS coordinates which I
retrieve from addresses. The application should give me the top X
nearest coordinates based on my current location.

This application is possible (I think) with the distanceBetween
function. But (I think) the application is really inefficient when i
iterate through the list of 400 coordinates and check the distance
within a certain time interval.
Another option is (I think) the proximityAlert function? All
coordinates are loaded in this function and when my current location
comes in the radius of a coordinate an alert is given. But the
downside of this solution (I think) is the high memory usage which
implies a short battery life of the Android phone?

Please can anybody help me to make the right decision?

Greets,
Martijn

--~--~---------~--~----~------------~-------~--~----~



GPS coordinates within certain radius based on current location

by String » Fri, 04 Sep 2009 04:43:36 GMT


 This is a common problem in GIS. I'd suggest doing a simple check for
whether each point is within a simple lat/lon box - that should be
fast enough with only 400 points, and should narrow down the list
enough to be able to check the distance on just those few.

If you're doing this a lot, put the data in SQLite with indexes on lat
& lon; that way you can do this initial "box" query easily &
efficiently.

String



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


GPS coordinates within certain radius based on current location

by gjs » Fri, 04 Sep 2009 14:49:19 GMT


 Hi,

There is a description about a GeoBox algorithm & some python source
code located here -

 http://code.google.com/appengine/articles/geosearch.html 

Regards




--~--~---------~--~----~------------~-------~--~----~



GPS coordinates within certain radius based on current location

by Martijn van der Plaat » Fri, 04 Sep 2009 16:40:48 GMT


 Thank you Gary,

Is it true that, when i use SQLite and not the Google App Engine, the
first algorithm in that GeoBOX story is good enough, because i dont
use App Engine?

SELECT *
FROM Business
WHERE Lat > (position_lat - d) AND
      Lat < (position_lat + d) AND
      Lon > (position_lon - d) AND
      Lon < (position_lon + d);

Last thing i need to know is how to calculate the variable "d" in the
above query, if the box is -say- a 1 mile radius.

Greets,
Martijn






--~--~---------~--~----~------------~-------~--~----~



GPS coordinates within certain radius based on current location

by Neil » Fri, 04 Sep 2009 17:12:05 GMT


 i Martijn

I did it like this:


private double[] getBoundingBox(final double pLatitude, final
double pLongitude, final int pDistanceInMeters) {

final double[] boundingBox = new double[4];

final double latRadian = Math.toRadians(pLatitude);

final double degLatKm = 110.574235;
final double degLongKm = 110.572833 * Math.cos(latRadian);
final double deltaLat = pDistanceInMeters / 1000.0 / degLatKm;
final double deltaLong = pDistanceInMeters / 1000.0 /
degLongKm;

final double minLat = pLatitude - deltaLat;
final double minLong = pLongitude - deltaLong;
final double maxLat = pLatitude + deltaLat;
final double maxLong = pLongitude + deltaLong;

boundingBox[0] = minLat;
boundingBox[1] = minLong;
boundingBox[2] = maxLat;
boundingBox[3] = maxLong;

return boundingBox;
}


The code is copied from mini_osm.py which you can find here:
http://gagravarr.org/code/


Regards

Neil

http://l6n.org/android/




On Sep 4, 10:39am, Martijn van der Plaat <martijnpl...@gmail.com>
wrote:
--~--~---------~--~----~------------~-------~--~----~



GPS coordinates within certain radius based on current location

by Nils » Sat, 05 Sep 2009 06:02:02 GMT


 nother possibility would to have the 400 points on a server, and then
just upload your own position and let the server do all the
calculations.
/Smartass

On Sep 4, 11:11am, Neil <neilb...@gmail.com> wrote:

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Unacceptable and abusive comments needs immediate solution from Google

This is an excerpt from an application comment:

"This stupid {*filter*}ing shit isn't downloading/installing! What a waste
sherelle 2009-04-08 04:00:44"

As a developer, I would like to know when is Google going to start
moderating such illiterate and ignorant people from commenting on an
issue developer has no control. At least, the curse words should be
removed or 'moderated' for keeping the developer community sane. Keep
in mind, in the long run its the developers and their application that
will eventually sell and market android platform.

As a developer, all ignorant and abusive comments are least
productive. Also Google's inaction in removing abusive comments are
totally unacceptable.

As a developer, I request Google to take immediate action by removing
comments which are abusive or totally remove commenting but keep the
star rating until Google provides a complete solution.



--~--~---------~--~----~------------~-------~--~----~

2. play video

Hi.. to all

               Can anyone tell me that how to run video file in
android emulator. I am using windows flat form. It is possible to run
video file in android emulator using  windows flat form... If possible
please tell me how to run...


Thank You
Nithin N V


--~--~---------~--~----~------------~-------~--~----~

3. AlertDialog.getListView() missing in 1.1r1 sdk

4. Need clarification for the SmsManager doc

5. romantic hearts

6. EARN ESSY

7. ListView not touchable in my Activity - A clue...not the solution though..