Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12615] iOS: Ti.Geolocation.forwardGeocoder is not getting Non US address to lat and long values

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2013-02-21T00:23:49.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2013 Sprint 04 API, 2013 Sprint 04
ComponentsiOS
Labelsn/a
ReporterMauro Parra-Miranda
AssigneeVishal Duggal
Created2013-02-07T05:45:46.000+0000
Updated2017-03-20T20:21:42.000+0000

Description

Problem Description

When you pass a non us address to Ti.GeoLocation.forwardGeocoder(), it will fail returning null values.

Test Case

Same location queried through out Maps GoogleAPIs returns coords according the place.
var nonUS = "Hyderabad";
var Tokio = "Tokio";
var US = "Salt Lake city";
  
Titanium.Geolocation.forwardGeocoder( nonUS, function(evt)
{
    Ti.API.info( "lat: "+evt.latitude+", long: "+ evt.longitude );
    Ti.API.info( JSON.stringify(evt) );
});
 
xhr = Titanium.Network.createHTTPClient();
var query = nonUS;
xhr.open('GET', 'http://maps.googleapis.com/maps/geo?output=json&q=' + query);
xhr.onload = function() {
    var json = JSON.parse(this.responseText);
    Ti.API.info(json);
     //17.385044,78.486671
};
xhr.send();

Extra info

The customer just want to show a proper annotation in the map to a particular location. i.e., need latitude and longitude values for "Ameerpet, Hyderabad"
var address =  "Ameerpet,Hyderabad";
 
Titanium.Geolocation.forwardGeocoder( address, function(evt)
{
    Ti.API.info( "lat: "+evt.latitude+", long: "+ evt.longitude );
    Ti.API.info( JSON.stringify(evt) );
});
Right now a workaround will be changing from "Ameerpet, Hyderabad" to "Ameerpet-Hyderabad", that will return the right coordinates, except in cases where you send a full address, like: "Shantipath, Chanakyapuri New Delhi, India", which is a valid address and will return empty.

Comments

  1. Vishal Duggal 2013-02-21

    Docs are being updated with platform limitations here https://github.com/appcelerator/titanium_mobile/pull/3893 Marking this ticket as won't fix.
  2. Vishal Duggal 2013-02-21

    Doc Update The module provides two methods, [forwardGeocoder](Titanium.Geolocation.forwardGeocoder) and [reverseGeocoder](Titanium.Geolocation.reverseGeocoder) to convert between geographic coordinates and addresses. These methods map to MapQuest Open Nominatim Search Service. While this API has the advantage that it has no daily usage limits, please note that the data backing this API is crowd sourced and might not return proper values for valid addresses and geographic coordinates. If geocoding services are essential component of the application, developers are encouraged to use commercial geocoding providers.
  3. Lee Morris 2017-03-20

    Closing ticket as the issue will not fix.

JSON Source