Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16954] Ti.Geolocation.forwardGeocoder returning undefined error

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionNot Our Bug
Resolution Date2014-05-16T21:25:10.000+0000
Affected Version/sRelease 3.2.2
Fix Version/sn/a
Componentsn/a
Labelslook1, supportTeam
ReporterMarco Cota
AssigneeIngo Muschenetz
Created2014-05-13T21:51:50.000+0000
Updated2017-03-29T16:33:33.000+0000

Description

Description

While customer calls Ti.Geolocation.forwardGeocoder returns and undefined error, when calling the Ti.Geolocation.reverseGeocode in order to get a valid address works ok but even using this address the Ti.Geolocation.forwardGeocoder is returning a undefined value in both Android and iOS.

Testcase

// Create our Window
var window = Titanium.UI.createWindow({  
    title:'NexPlayer Modules P.O.C.',
    backgroundColor:'#fff'
});

Ti.Geolocation.preferredProvider = "gps";
Ti.Geolocation.purpose = "Locate user";
	
if (Titanium.Geolocation.locationServicesEnabled === false)
	{
		Titanium.UI.createAlertDialog({title:'Kitchen Sink', message:'Your device has geo turned off - turn it on.'}).show();
	}

var addr;

Titanium.Geolocation.reverseGeocoder("19.423025131225586","-99.1595687866211",function(evt)
{
	if (evt.success) {
		var text = "";
		for (var i = 0; i < evt.places.length; i++) {
			text += "" + i + ") " + evt.places[i].address + "\n";
			addr = evt.places[i].address;
		}
		Ti.API.info('Reversed forward: '+text);
		
		Titanium.Geolocation.forwardGeocoder(addr,function(evt)
		{
			Ti.API.info('in forward ' + addr);
			Ti.API.info("lat:"+evt.latitude+", long:"+evt.longitude);
			Titanium.Geolocation.reverseGeocoder(evt.latitude,evt.longitude,function(evt)
			{
				if (evt.success) {
					var text = "";
					for (var i = 0; i < evt.places.length; i++) {
						text += "" + i + ") " + evt.places[i].address + "\n";
					}
					Ti.API.info('Reversed forward: '+text);
				}
				else {
					Ti.UI.createAlertDialog({
						title:'Forward geo error',
						message:evt.error
					}).show();
					Ti.API.info("Code translation: "+evt.code);
				}
			});
		});
		
	}
	else {
		Ti.UI.createAlertDialog({
			title:'Forward geo error',
			message:evt.error
		}).show();
		Ti.API.info("Code translation: "+evt.code);
	}
	
	
	
	
});

window.open();

Logs

IOS
May 13 16:16:13 iPhone-de-Marco testcase[2141] <Warning>: [INFO] testcase/1.0 (3.2.2.GA.96e9a07)
May 13 16:16:13 iPhone-de-Marco testcase[2141] <Warning>: [DEBUG] Analytics is enabled = YES
May 13 16:16:13 iPhone-de-Marco testcase[2141] <Warning>: [DEBUG] Loading: /var/mobile/Applications/41289ADA-373E-4DBD-B31C-EC4F33436519/testcase.app/app.js, Resource: app_js
May 13 16:16:13 iPhone-de-Marco testcase[2141] <Warning>: [DEBUG] Application booted in 58.427036 ms
May 13 16:16:13 iPhone-de-Marco testcase[2141] <Warning>: [INFO] Reversed forward: 0) Banamex, Cordoba, Benito Júarez, Ciudad de México, Distrito Federal, 06700, México
May 13 16:16:14 iPhone-de-Marco wifid[40] <Error>: WiFi:[421708574.009947]: Enable WoW requested by "apsd"
May 13 16:16:16 iPhone-de-Marco testcase[2141] <Warning>: [INFO] in forward Banamex, Cordoba, Benito Júarez, Ciudad de México, Distrito Federal, 06700, México
May 13 16:16:16 iPhone-de-Marco testcase[2141] <Warning>: [INFO] lat:undefined, long:undefined
May 13 16:16:17 iPhone-de-Marco testcase[2141] <Warning>: [INFO] Code translation: -1
May 13 16:16:19 iPhone-de-Marco profiled[2140] <Notice>: (Note ) profiled: Service stopping.
Android
EBUG] :  OpenGLRenderer: Enabling debug mode 0
[INFO] :   Reversed forward: 0) Banamex, Cordoba, Benito Júarez, Ciudad de México, Distrito Federal, 06700, México
[INFO] :   in forward Banamex, Cordoba, Benito Júarez, Ciudad de México, Distrito Federal, 06700, México
[INFO] :   lat:undefined, long:undefined
[ERROR] :  GeolocationModule: Invalid value, expected type Number.
[ERROR] :  TiExceptionHandler: (main) [4179,4179] ----- Titanium Javascript Runtime Error -----
[ERROR] :  TiExceptionHandler: (main) [1,4180] - In app.js:31,25
[ERROR] :  TiExceptionHandler: (main) [0,4180] - Message: Uncaught Error: Invalid value, expected type Number.
[ERROR] :  TiExceptionHandler: (main) [0,4180] - Source: 			Titanium.Geolocation.reverseGeocoder(evt.latitude,evt.longitude,function(ev
[DEBUG] :  dalvikvm: GC_FOR_ALLOC freed 101K, 15% free 24159K/28216K, paused 22ms, total 23ms
[DEBUG] :  dalvikvm: GC_FOR_ALLOC freed 39K, 15% free 24341K/28440K, paused 28ms, total 28ms
[INFO] :   I/dalvikvm-heap: Grow heap (frag case) to 29.885MB for 2536936-byte allocation
[ERROR] :  V8Exception: Exception occurred at app.js:31: Uncaught Error: Invalid value, expected type Number.
[ERROR] :  ViewRootImpl: sendUserActionEvent() mView == null

Comments

  1. Marco Cota 2014-05-16

    I have done some testing directly with the mapquestapi.com (the service we use for geocoding) and found some issues with their service. If we do a reverse geocode search http://open.mapquestapi.com/nominatim/v1/reverse?lat=37.3892876&lon=-122.0502364 we will receive a success result:
       <reversegeocode timestamp="Fri, 16 May 14 14:32:24 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright"querystring="lat=37.3892876&lon=-122.0502364">
       <result place_id="2445350447" osm_type="way" osm_id="8943342" ref="North Bernardo Avenue" lat="37.3884004" lon="-122.0512303">
       North Bernardo Avenue, Whisman Station, Mountain View, Santa Clara County, California, 94043, United States of America
       </result>
       <addressparts>
       <road>North Bernardo Avenue</road>
       <neighbourhood>Whisman Station</neighbourhood>
       <city>Mountain View</city>
       <county>Santa Clara County</county>
       <state>California</state>
       <postcode>94043</postcode>
       <country>United States of America</country>
       <country_code>us</country_code>
       </addressparts>
       </reversegeocode>
       
    While using the address we got from their service "North Bernardo Avenue, Whisman Station, Mountain View, Santa Clara County, California, 94043, United States of America" in their search api we receive "No search results found" http://open.mapquestapi.com/nominatim/v1/search.php?q=North%20Bernardo%20Avenue%20Whisman%20Station%20Mountain%20View%20Santa%20Clara%20County%20California%2094043%20United%20States%20of%20America If we use the same search call but replacing the address with "North Bernardo AV Mountain View CA 94043" we will get an actual result. http://open.mapquestapi.com/nominatim/v1/search.php?q=North+Bernardo+Ave+Mountain+View+CA+94043&viewbox=-91.41%2C48.11%2C91.41%2C-48.11
  2. Lee Morris 2017-03-29

    Closing ticket as "Not Our Bug".

JSON Source