views:

106

answers:

3

I want to be able to plot every hospital within 10 miles of my current location on the map in Android. I've already started with this code as a base (http://android-er.blogspot.com/2009/11/androidlocation-with-zoom-level-control.html) I just need to plot the locations of hospitals without switching to another screen.

A: 

Here is everything that I've done so far. http://www.mediafire.com/file/c0mzxdmtvnh/LyfeLink.zip

Pitney
A: 

Well, I guess, you need to first use the Google Local search with parameters like Hospitals near "this". and get the results. You will also get the lat and lon info. Before this, get hold of your location, reverse geo code and get the address.

And then, when you have all these locations, draw them on the map.

But, the 10 miles criteria might be just a bit more difficult to achieve.

http://tech-droid.blogspot.com

Kumar Bibek
A: 

As far as finding the hospitals, I think your going to need some sort of database, either locally as an sqlite file or through a server that you host (rails and php will have lots of tutorials for this specific problem). You will need to scrape together/buy a list of locations of the hospitals to populate your database as well.

Check out these resources for building the database.

Creating a Store Locator with PHP, MySQL & Google Maps http://code.google.com/apis/maps/articles/phpsqlsearch.html

(pay special attention to the SQL search query)

SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;

Also check out these books (or at least the source code thats posted on the site) for Rails and PHP. I bought the rails book and would highly recommend it for the type of project your doing.

http://www.googlemapsbook.com/book/

Sample code to calculate distance between two lat,lng points in in various languages http://www.zipcodeworld.com/developers.htm

Ben Holland