Aaah I see. Well that's not a problem, I too am just interested in the
latitude / longitude data. Maybe it would have been cool if we were
able to distinguish between locations when the query isn't unique, but
I guess we can't ask for more when the API is not officially
supported.
Thanks for the help!
On 25 Mrz., 01:39, "Dan U." <[EMAIL PROTECTED]> wrote:
> I see the problem. Apparently not all matches will return a address
> line (and I'm guessing other data as well). That's why it works for
> me, since I just want lat/long which it gives me every time. Since
> GmmGeocoder isn't supported, there's not a lot you can probably do
> with regard to asking Google to fix it. I doubt there is much of a fix
> either. It's probably data off their server that is missing.
>
> On Mar 24, 5:11 pm, q2dm1 <[EMAIL PROTECTED]> wrote:
>
> > Sure, that's the relevant fragment:
>
> > try {
> > GmmGeocoder geocoder = new
> > GmmGeocoder(Locale.getDefault());
> > Address[] addresses =
> > geocoder.query(((TextView)findViewById(R.id.text_proximity)).getText().toString(),
> >
> > GmmGeocoder.QUERY_TYPE_LOCATION, 0, 0, 180, 360);
>
> > if(addresses != null)
> > for(Address a : addresses) {
> > Log.e(TAG,
> > a.getAddressLine(0));
> > }
> > else
> > Log.e(TAG, "addresses is null");
> > }
> > catch(Exception e) {
> > Log.e(TAG, "" + e);
> > }
>
> > On 24 Mrz., 23:48, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > > Can you post the code that doesn't work? I went into my app and
> > > searched for New York and got New York City. Every thing I've ever
> > > searched for with GmmGeocoder has worked. Geocoder, on the other hand,
> > > only has a handful of addresses.
>
> > > On Mar 24, 3:33 pm, q2dm1 <[EMAIL PROTECTED]> wrote:
>
> > > > Sorry to bump, but it seems that the GmmGeocoder service only uses a
> > > > couple of actual addresses. "White" yields a couple of cities in the
> > > > States, whereas "New York" does nothing. Can anyonne confirm that?
>
> > > > On Feb 22, 12:55 am, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > > > > Megha is correct in that it's not supported, but if you are looking
> > > > > for *actual* functionality in order to impress challenge judges,
> > > > > Geocoder falls flat on its face. It's sort of a tradeoff on what you
> > > > > want. Personally, I'd like to impress the judges now and change my
> > > > > code later to use the supported api when it performs acceptably. I can
> > > > > only hope either Geocoder works well in the next sdk or
> > > > > thatGmmGeocoderis still there. If not, I might not upgrade prior to
> > > > > challenge submission.
>
> > > > > On Feb 21, 3:43 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi,
>
> > > > > > TheGmmGeocoderAPI should not be used. It is not supported in the
> > > > > > current
> > > > > > release of the SDK.
>
> > > > > > Please see the code below for an example of using GeoCoder APIs:
>
> > > > > > public class MyGeocoder implements Runnable {
>
> > > > > > public void run() {
> > > > > > Locale locale = new Locale("en", "us");
> > > > > > Geocoder g = new Geocoder(locale);
> > > > > > try {
> > > > > > Address[] addresses1 =
> > > > > > g.getFromBusinessName("Zachary's Chicago Pizza",
> > > > > > 0.0, 0.0, 180.0, 360.0);
> > > > > > if (addresses1 == null) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > HashSet<String> addrSet = new HashSet<String>();
> > > > > > for (Address a : addresses1) {
> > > > > > addrSet.add(a.getAddressLine(0));
> > > > > > }
>
> > > > > > if (addrSet.size() != 3) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (!addrSet.contains("5801 College Ave")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (!addrSet.contains("1853 Solano Ave")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (!addrSet.contains("3110 Crow Canyon Road")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > } catch (IOException ioe1) {
> > > > > > Log.e("GeocoderTest", "ioe1 = " + ioe1);
> > > > > > throw new RuntimeException();
> > > > > > }
>
> > > > > > try {
> > > > > > Address[] addresses2 =
> > > > > > g.getFromLocationName("1600 Pennsylvania Ave,
> > > > > > Washington D.C
> > > > > > .",
> > > > > > 0.0, 0.0, 180.0, 360.0);
> > > > > > if (addresses2 == null) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (addresses2.length != 1) {
> > > > > > throw new RuntimeException();
> > > > > > }
>
> > > > > > Address addr = addresses2[0];
> > > > > > if (!addr.getAddressLine(0).
> > > > > > equals("1600 Pennsylvania Ave NW")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (!addr.getAddressLine(1).
> > > > > > equals("Washington, DC 20006")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (!addr.getLocality().equals("Washington")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (!addr.getRegion().equals("DC")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (!addr.getPostalCode().equals("20006")) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (Math.abs(addr.getLatitude() - 38.898763) > 0.1) {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > if (Math.abs(addr.getLongitude() - (-77.036655)) > 0.1)
> > > > > > {
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > } catch (IOException ioe2) {
> > > > > > Log.e("GeocoderTest", "ioe2 = " + ioe2);
> > > > > > throw new RuntimeException();
> > > > > > }
> > > > > > }
>
> > > > > > }
>
> > > > > > Let us know if you face any issues..
> > > > > > Also, you can use a *BUMP* to highlight posts where you don't find a
> > > > > > solution after lots of discussions and we will try to address them
> > > > > > :)
>
> > > > > > Thanks,
> > > > > > Megha
>
> > > > > > On Thu, Feb 21, 2008 at 11:41 AM, Dan U. <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I attempted to useGmmGeocoderfor this. What I saw was that
> > > > > > > apparently the query type integer that got passed in and sent to
> > > > > > > googles glm server (http://www.google.com/glm/mmap) for reverse
> > > > > > > lookups was incorrect. I don't know what the correct one is, or if
> > > > > > > there is one. I instead tried QUERY_TYPE_LOCATION as the type and
> > > > > > > got
> > > > > > > a response. It was smart enough to parse the lat/long into
> > > > > > > degrees/
> > > > > > > minutes/seconds, but not enough to tell me any address
> > > > > > > information. It
> > > > > > > looks to me like reverse geocoding is not working yet, but I
> > > > > > > might be
> > > > > > > wrong.
>
> > > > > > > On Feb 21, 12:45 am, rezar <[EMAIL PROTECTED]> wrote:
> > > > > > > > Hi
>
> > > > > > > > Does anybody make any success using geoCoder to convert
> > > > > > > > location to
> > > > > > > > address ?
> > > > > > > > Few days ago there are lots of discussion, but nobody was
> > > > > > > > successful.
>
> > > > > > > > Thank you
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---