Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Latest news

Last at Tue, 6 Dec 2011 18:37:53
Topic: New BlackBerry sample app
See more news »

get position from adress

11 replies [Last post]
Westkane
User offline. Last seen 1 year 42 weeks ago. Offline
Joined: 09/02/2009

Is there a way using the MGMaps Lib to get the GPS position from a adress?

jaak
User offline. Last seen 13 hours 7 min ago. Offline
Joined: 06/19/2008

You probably mean geocoding, address search? This is possible.
1. implement GeocodingResultWaiter on your class
2. it requires adding methods searchResults(KmlPlace[]) and errors(int errorId)
3. call geocoder:

final int[] cat = new int[0];
final GeocodingService service = new GeocodingService(this, GeocodingService.DEFAULT_URL,
"en", new WgsPoint(0,0), queryString, GeocodingService.SEARCH_TYPE_GEOCODING, cat, 10, false);
service.execute();

4. if result is ok, searchResults() is called as callback method with array if KmlPlace objects (in best case there is just one, but often search is too ambigious). If error, then errors() is called

See from samples "mapper" application, it has placename search functionality.

/JaakL

Westkane
User offline. Last seen 1 year 42 weeks ago. Offline
Joined: 09/02/2009

Thanks

Sundar
User offline. Last seen 1 year 27 weeks ago. Offline
Joined: 12/04/2009

Does it work now ?

It gives me the following error..

Info > Downloading http://lbs.nutiteq.ee/cloudmade/geocode_kml.php?out=kml&near=59%2E439489N%2C%2024%2E75769E&t=q&q=London&lang=et&cat=&max=10&gzip=yes

Debug > TO: ineterrupt after 20000
Debug > Connection opened in 21328
Debug > Response NOT packed based on first 2 data bytes
Debug > Error decompressing gzip data, using it as uncompressed
Debug > KmlReader done
Debug > Response read in 94

- sundar

jaak
User offline. Last seen 13 hours 7 min ago. Offline
Joined: 06/19/2008

It seems that it does not work now. There is some network configuration issue, will be fixed soon.

/JaakL

jaak
User offline. Last seen 13 hours 7 min ago. Offline
Joined: 06/19/2008

Should be fixed now. Please report if irregularities are there.

/JaakL

sasquatchsoftware
User offline. Last seen 1 year 18 weeks ago. Offline
Joined: 05/10/2010

Hi jaak, seems like geocoding service is down again. I am getting the "Response NOT packed based on first 2 data bytes" error. Do u what might be the problem?

my code is like this:
_googleKML = new GeocodingService(thisScreen, GeocodingService.DEFAULT_URL,
"et", currentWP, "Vancouver", GeocodingService.SEARCH_TYPE_GEOCODING, new int[0], 10, false);
_googleKML.execute();

the Console debugged is:
Info > Downloading http://lbs.nutiteq.ee/cloudmade/geocode_kml.php?out=kml&near=48%2E144097N%2C%20%2D121%2E915283E&t=q&q=Vancouver&lang=et&cat=&max=10&gzip=no;deviceside=true
Debug > Connection opened in 916
needRepaint complete=true
needRepaint complete=true
Debug > Response NOT packed based on first 2 data bytes
needRepaint complete=true
needRepaint complete=true
Debug > KmlReader done

sasquatchsoftware
User offline. Last seen 1 year 18 weeks ago. Offline
Joined: 05/10/2010

oh, it seems to work alright. Just getting the debug message: "Debug > Response NOT packed based on first 2 data bytes" and thought it's not working again.

What does "Debug > Response NOT packed based on first 2 data bytes" mean?

jaak
User offline. Last seen 13 hours 7 min ago. Offline
Joined: 06/19/2008

You can just ignore it. Message comes as the geocoding proxy can gzip response, so there is less data in the HTTP traffic. For easier troubleshooting the compression is off currently. Client detects automatically whether data is gzip-ed or not (based on GZIP header signature).

Btw, can you try also direct service to CloudMade, without the proxy? It was just added to the latest beta (nutiteq.com/beta/lib) as CloudMadeGeocodingService() . See http://www.nutiteq.com/query-string-encoding-geocodingservice post last comments.

/JaakL

doraenino
User offline. Last seen 1 year 42 weeks ago. Offline
Joined: 12/27/2009

I try to do like that and it works fine. But some queryString (Street name in my city - Hanoi, VietNam), it gets errors.

Can I replace GeocodingService.DEFAULT_URL with another geocoding services URL ? Can you suggest some ?

jaak
User offline. Last seen 13 hours 7 min ago. Offline
Joined: 06/19/2008

Yes, you can change the URL, but I do not know really any good alternative now for the area.

/JaakL