My geocoder search dialog suggestions differ from Google Map

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

My geocoder search dialog suggestions differ from Google Map

Postby GlennMiller » Tue Nov 02, 2010 6:55 pm

My application includes a MapActivity and the Android Search Dialog to allow the user to type a map address to zoom the map. I am using a ContentProvider's query method to offer search suggestions as they type an address in the Search Dialog.

I am testing my results on my HTC Incredible, and noticed I am not getting as accurate suggestions as Android's Google Map search is giving. I'm assuming they are using the same GeoCoder logic I am. For example, in Google Map's if I type in "Eiff" I immediately get results for the "Eiffel Tower, Quai Branly, Paris, France", etc., but with my code, I don't get any results. I have the same inconsistency whether I use a street address or landmark in my query.

Any ideas?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private Cursor getSuggestions(String query) {
  2.  
  3.                 final MatrixCursor result = new MatrixCursor(new String[] {
  4.                                 BaseColumns._ID, // must include this column
  5.                                 SearchManager.SUGGEST_COLUMN_TEXT_1});
  6.  
  7.                 Geocoder geoCoder = new Geocoder(getContext(),
  8.                                 Locale.getDefault());
  9.                 try {
  10.                         List<Address> addresses = geoCoder.getFromLocationName(query, 10);
  11.  
  12.                         int i = 0;
  13.                         for (Address address : addresses) {
  14.                                         result.addRow(new Object[] { i++, address.getAddressLine(0)});
  15.                         }
  16.                 } catch (IOException e) {
  17.                         e.printStackTrace();
  18.                 }
  19.  
  20.                 return result;
  21.         }
  22.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
GlennMiller
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Nov 02, 2010 6:36 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 5 guests