Mapbox - Reverse Geocoding - multiple language response - android

I'm using Mapbox to Reverse geocode a latitude, longitude location and wanted the city name(Place name) response with multiple languages.
The documentation says,
'If more than one language tag is supplied, text in all requested languages will be returned'
But I'm getting the response only in the first language specified.
MapboxGeocoding.builder()
.accessToken("xyz..."),
.query(Point.fromLngLat(-123.1207, 49.2827))
.languages("zh-CN,ru")
.geocodingTypes(GeocodingCriteria.TYPE_PLACE)
.mode(GeocodingCriteria.MODE_PLACES)
.build();
This returns the place name in Chinese and not Russian.
Documentation : https://www.mapbox.com/android-docs/api/mapbox-java/libjava-services/4.0.0/index.html
Verison used: 'com.mapbox.mapboxsdk:mapbox-sdk-services:4.1.0' and also 'com.mapbox.mapboxsdk:mapbox-sdk-services:4.1.0-SNAPSHOT'

I have contacted the Mapbox team. Apparently, this is a bug in their Mobile SDK but their API works fine. Have reported this here. https://github.com/mapbox/mapbox-java/issues/446

Related

Android mapquest geocoder country-setting

Since I own an app key for mapquest (community edition), all geocoding requests end up in US only. Before I entered the app key geocoding european locations was possible.
I couldn't find a method to set a default country. Even initializing the geocoder object with a Locale didn't work.
Any suggestions?
Currently the mapquest Android API doesn't support single line international geocoding.
This is the reply I got from mapquest:
I checked at our Android API is still using our v1 geocoder which does
not support single line international geocoding. My support suggested
you use our geocoding web service for the geocoding first:
http://developer.mapquest.com/web/products/dev-services/geocoding-ws
Again just make sure the request says “v2”.

Google Map APIs : UK specific results

I'm developing a map application in Android. I'm using Google maps API to show results in Autocomplete textview dropdown .The results this API is returning is of the places of the entire world . I want to show results o provide solutions to places only of a particular country eg .UK
How should I do it . Is there any specific flag to be set for it .
My URL :
private static String SUGGETION_URL = "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=%s&types=geocode&sensor=true&key=xxxxx.xxx-xxxxx";
Please suggest ways by which this url will return results to places only in UK ?
There's no way to force the API to restrict it's results to a region like you can in some of the other Google Maps Web Service APIs. If you really need that functionality then maybe you should be using the Geocoding API or the Places Autocomplete API as included in the Google Maps JS V3 API.
If you can't use either of those two suggestions your options are limited to:
You can use the location / radius parameters like you found, but there are treated as more like "suggestions" than absolutes.
I'd try setting the language parameter to en-GB which might favor UK-based results slightly over others.

Mobile web driving directions from current location

I'm building a mobile-version of a website, trying to have one-click link to launch Google Maps with driving directions to the business, from the user's current location. I have it working fine for the iPhone, but when testing on Android, it views 'Current%20Location' and tries to find a business called 'Current Location'. Here is my current code:
Get Directions
I need a universal string to search from the current location, and can't find a definitive answer anywhere online.
Thanks in advance for any help!
I am doing the same thing and now have it working on Android. I don't have an iPhone so I have no way of testing on that. You should leave the saddr parameter blank in the URL, and Google Maps will then prefill it with the user's current location. Also, use + signs instead of spaces in the destination address. Here's the corrected URL:
http://maps.google.com/maps?saddr=&daddr=123+Street+Rd,Cityville,MD,21098
Use the google gps api to get the currentlocation and pass it to maps. Even better I think there's an action to open the built-in maps application asking it to route from current location to your address.
This article on location services should help http://developer.android.com/guide/topics/location/index.html
If you're trying to do it fully through the web, I think the user has to enable location services on the google webpage for it to work.
Also, check out this javascript library that provides a platform neutral api for gps services on most devices http://code.google.com/p/geo-location-javascript/
Google Maps with directions from current location
https://maps.google.com/maps?saddr=&daddr=35.658157,139.697174&sensor=TRUE
https://maps.google.com/maps?saddr=&daddr= PLUS
"location's_latitude" PLUS
"," PLUS
"location's_longitude" PLUS
"&sensor=TRUE" // for getting your current location
Probably the most accurate way using lat and long
<span class="addressAt">
<a href="http://maps.google.com/maps?f=d&hl=en&region=US&doflg=ptm&geocode=&saddr=&daddr=41.75553,-88.322048" target="_blank">213 S River St
Aurora, IL</a>
</span>
This is the only way to get an accurate "my location" on the google maps mobile site. Replace the coordinates(41.75553,-88.322048) with your locations coords. All other ways just wrote in my location as the start address without actually getting the real time location.

Geoder.getFromLocationName doesn't give the same results as maps.google.nl

First of all: Geocoder is present and works fine on my android application. It gives results for the examples from the android documentation:
"Dalvik, Iceland", an address such as "1600 Amphitheatre Parkway, Mountain View, CA", an airport code such as "SFO", etc..
But when I search a restaurant or something like that in my own country, the Netherlands, geocoder won't find anything. But if I type the same query string into maps.google.nl it gives me directly the restaurant I was looking for.
I already have tried to restrict the geocoder within two long/lat points, but that doesn't make any difference. So it seems that I can find anything in de US easily, but finding a location of a restaurant in the Netherlands doesn't work
The Google Geocoding API (which I think is what your Android app is querying) will only return geographical features, not business listings. Those are available on Google Maps because that's an application and uses more search backends than the Geocoding API.
Appending the country name won't help, what you'll get in your Android app (using the geocoder) is the same you will get from the Google Maps API v3 Geocoder Tool. It does include some POIs, but not all business listings (restaurants, hotels, etc.).
Some time ago I had a similar problem with UK adresses, I believe it's because the web app has more context than just the portion of the map you're looking at (like which countries are in view).
If I recall correctly, I solved it by appending ", UK" or ", GB" (or ", United Kingdom" / ", Great Britain") to all queries, so in your case try appending ", Netherlands".

Android Geocoder - different results when called from different geographical locations

I have the following code in my Android program
List<Address> addressList = geoCoder.getFromLocation(37.790551,-122.433931, 1);
if (!addressList.isEmpty()) {
address = addressList.get(0);
String number = address.getSubThoroughfare();
String streetName = address.getThoroughfare();
.....
}
This is a request to essentially get a street name (hence the 1) from a latitude and longitude in San Francisco.
When I execute this program on a phone in Europe (specifically Ireland) number is returned as 2250-2290 and streetname is returned as Fillmore St.
When I get a friend to run the same code on his phone in California number is null and streetname is still Fillmore st.
I've seen other SO questions allude to region settings but is this possible that the geographical location can affect the query in the Android API?
The Javascript Geocoding API mentions region bias. I wonder is it possible to do something similar in the Android API. I did try creating the Geocoder as
Geocoder geoCoder = new Geocoder(getApplicationContext(), Locale.US);
but this does not re-recreate the California based result.
From getting people to run identical code on different continents it seems that location is indeed a factor.
The Javascript geocoding allows you to specify a region though
Are the phones running different versions of android? Also, another thing to keep in mind is that "The Geocoder class requires a backend service that is not included in the core android framework." So, if the two phones are calling upon different backend services to query for the Geocoder, that may explain the output you are seeing.
I think with Android 1.5, they included a Google API backend service implementation for Geocoder. I don't know if newer versions of Android and the Google API made changes to the Geocoder implementation that may be giving you different results or it's coming from some other backend service.

Categories

Resources