Location-aware geocoding on Android (just like Google Maps) - android

It seems that the search in the Google Maps app is location aware. For example, if I search for "Pitt St" while in Sydney, it finds the right street straight away. Clicking "Did you mean..." brings a list of other "Pitt St" close in nearby suburbs.
Is there a way to ge a similar experience in our apps? I tried the standard Geocoder, but a similar search returns "Pitt St, New York" as the first match.
Is there a set of options I'm missing?
Is there a different API we can use for this?
As a last resort, do you think it's reasonable to implement this manually, for example by querying the Geocoder with a max radius of 1km, 10km, 100km, and then sorting the results by distance?
Cheers
Romain

Which function did you use? Geocoder.getFromLocationName() takes a bounding box that allows you to limit the results to a certain region, so you could get the current GPS position first and pass that in.
Alternatively, you could go through the Geocoder API which is more flexible, but also more restrictive in terms of the TOS, not to mention a lot more work to use. (I'm not sure if using it from an Android app is covered in the TOS, I haven't looked at it much).

Related

Google Places/Maps - any way to deduce the environment type of a location? E.g. near a beach, mountain, etc)

Probably an obscure question, but worth asking anyway -
I know Google Places can tell if the user is near a certain city-based location, such as a park or gym, but is there a way (with or without Google's APIs) to deduce that a user is near such a feature as a 'mountain' or 'beach'? Not a specific one, just 'a' beach.
Even just a map of environment types somehow linked to lat/long bounds would be useful - e.g. 'desert', 'forest' etc. Sometimes, Google has a listing of such a place, but it's wildly imprecise - for example, within the 'park' category of Places, I can find nature reserves, national parks, protected areas (with beaches or mountains!), or even just that corner memorial park in the local town. Is there any way to be more specific than this?
You can try to use natural_feature type. This type might return beaches or mountains.
If that doesn't work, you can use open street maps and use the tag feature.

Google Maps API - Mark a street from start to end of a suburb

I'm not sure if this belongs in StackOverflow as it's not technically coding, but I can't think of where this would belong.
Currently, we're working on a mobile application that we're thinking of using the Google Maps API to return the start and end of a street's intersections in a particular suburb.
For example, if Suburb A encompasses half of Street B, it will only highlight that section of Street B.
After reading the following articles (Getting long/lat points of a suburb, getting start/end co-ords of a street), they basically summarise that
I believe that Google does not expose the information about the suburb's boundary. You could store the points in boundary yourself, and display them with a Polygon.
and
The Google Maps API v3 doesn't do that. You need to find a different data source or manually determine the coordinates.
so obviously that eliminates Google Maps. Is there any other map API that can be used both on mobile and web browsers that can display these highlighted street points?
Another option we are considering is that we manually insert the co-ordinates into a database and have the application/s read from that, and do as the first linked answer sort of implies, manually draw the routes?
Please don't hesitate to let me know if this question needs modification or to be moved to another exchange.
Great question, and I think found the answer (note this is for Australia, but a similar process could work elsewhere).
http://www.datalicious.com/blog/2012/03/19/free-australian-suburb-boundary-data-for-mapp/
This might help. They:
We used the Australian Bureau of Statistics data, which offers the suburb boundaries as an ESRI shapefile. This data in essence offers the perimeters of every suburb in Australia using GPS coordinates. The ABS offers some its boundary data in more friendly formats, but many are not – hence the blog post. The process involved importing the ESRI shapefile into an open-source program called Quantum GIS that allowed an export of the suburb boundaries into a format we could work with (i.e. CSV format).
If you could pull coordinates out of this you could then use this in google maps to find the suburb boundaries concerning the streets you want, and only select the section of the street within the suburb you want.
I'm sure there are other solutions, but I don't think it is possible directly through the Google Maps API (as indicated here: Accessing google maps area coordinates (suburb boundaries)).

Alternative(To Google Maps) Open Source Map API that provides a database of nodes and Arcs on roads

I need a Map API for Android that can provide me with indexed nodes and indices that make up the road network. The main idea is to determine if two GPS devices are on the same road. Thank you in advance
A Map API by itself will not have that information. Anyway, you can get it from OpenStreetMap freely. You can download it from here.
I don't understand from your question if you intend on displaying the results on a map. If so, and you want a nice and free map API, I would suggest Leaflet. It's not as mature as the likes of OpenLayers but, as you've tagged this post with "android", Leaflet just kicks ass in the mobile department.
OpenStreetMap is definitely a good source of data for this kind of project. Unlike google maps, it gives developers access to the underlying vector data of a map (fully open). This allows interesting new use cases which simply are not possible with google maps, and something involving geometric calculations like this would definitely fit into that category. You either need OpenStreetMap or some other source of "vector" map data, and beyond OpenStreetMap this can be expensive.
Unfortunately that's not the full answer to your question. You still have a lot of work to do to use the data in the way you intend. You need to calculate the proximity of two points (GPS readings from two devices?) to nearby roads, and figure out which road the point lies closest to. It's the kind of powerful geo calculation you might do using a GIS package such as QGIS or a functions of a geo-aware database system PostGIS.
But that's not the answer to your question, because you need to do these calculations on device. I'm not aware of an off-the-shelf library to do this on android. I think you would have to roll your own.
But another challenge is to get the vector data onto the device in a suitable format in the first place, and this is the first thing to solve. You'd want the vector data either as a large download for a whole country, or perhaps a smaller area, perhaps with an on-the-fly download feature within this app. Whole countries are not infeasible when working with maps in vector form (ever tried the awesome MayDroyd app?), but require some compact formatting. Happily some of these problems are starting to be solved in open source off-the-shelf libraries. You could try to build on top of MapsForge for example.
So then you're back to the challenge of writing on-device code to poke around in this data and do the calculations you want to do. I suppose it could be rather good if projects like MapsForge included generic PostGIS style geo-functions to make this easier. Something to ask the mapsforge developers about perhaps.

How do I find the point on a google map that's closest to me?

I am writing an Android-application that is supposed to download a bunch of addresses from my SQL-server, reverse geocode them, compare them all to my current location and return the one that is closest to me, not geometrically, but the one that I am the shortest driving distance from.
I have managed to get the reversed geocoding to work, but when I run my program a few times, I hit the OVER_QUERY_LIMIT on google. Needless to say, there are quite a few addresses in my database.
I understand that I could do this the quick and dirty way and just see which address is nearest to me by comparing the latitude and longitude of my current position and that of my addresses as opposed to comparing it to the actual driving distance. The problem with this is that this application will be used in a region where there are quite a lot of lakes to drive around and using that method will likely return quite a few stupid results.
How can I keep this from happening over and over? Can I present google with a view of all my addresses and just do a comparison once? I really need help with this one.
Actually, you will have to query a routing service (not necessarily Google Maps, to my knowledge also Cloudmade provides you with routing; there definitely are more) to get driving directions to each of the Points Of Interest around you and then select the closest one. This is a very bad practice, as you are very limited with the request amount.
According to the Google Maps API TOS (paragraph 10.1.3) you are not always allowed to do that.
What I did in a similar case was to store the coordinates for all POI, and look up the closest ones just by range of lat/lng.

Are the Sky Map APIs available?

I'm looking to build an application similar to Google Sky Map, and was wondering if it was possible to hook into any of the APIs it uses. If so, which ones? If not, how else can it be done?
From what i've read so far, I can do a search via an intent for any the objects in Google's sky map db.. but i'd like to have my own db of satellites going around the earth, and be able to track those, get reminders on fly-overs and so-on.. so i'd like to build this app, but i just need a jumping off point.
Thanks!

Categories

Resources