Check if an address is an airport?
If I use Android Geocoder
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocationName(addressName, 3);
How can I check if an address is an airport (or not)? Because there is no such a method in Address class?
I would like something like
Address address = addresses[0];
address.isAirport();
Am I forced to use classis Geocoding API and d开发者_C百科o the parsing and so on..? Because under Address Component Types I see an item
airport indicates an airport.
You can check Address.getFeatureName. You'll have to look for the string "airport" yourself though.
I have never used this, but if the functionality doesnt exist you need to create it. There arent that many airports in the US. Grabbing their geo coordinates, inserting them into a table, or array and looping through it would be really easy.
so if the address is in your list, then its an airport.
class adresss{
double array = {0.00,0.00,0.00}
loop through array check if geocoordinate is in your array, if it is return true; }
精彩评论