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

Uudised

Viimane: Tue, 17 May 2011 13:21:59
Teema: Nutimap Eesti kaardi asemele
Veel uudiseid »

Geocoding: exception when parsing location of a POI

10 replies [Last post]
mixa
User offline. Last seen 1 year 1 week ago. Offline
Joined: 01/13/2010

I've got following exception when tried geocoding for a POI (searched for "test"):
---

Info > Downloading http://lbs.nutiteq.ee/cloudmade/geocode_kml.php?out=kml&near=56%2E298538N%2C%2043%2E981704E&t=l&q=test&lang=ru&cat=&max=20&gzip=no
Debug > Connection opened in 972
Debug > Response NOT packed based on first 2 data bytes
java.lang.NumberFormatException: empty String
at java.lang.FloatingDecimal.readJavaFormatString(+29)
at java.lang.Double.parseDouble(+4)
at com.nutiteq.kml.KmlReader.parseWgsCoordinatesForPoint(+36)
at com.nutiteq.kml.KmlReader.readPoint(+35)
at com.nutiteq.kml.KmlReader.readPlace(+88)
at com.nutiteq.kml.KmlReader.read(+62)
at com.nutiteq.kml.KmlReader.dataRetrieved(+82)
at com.nutiteq.services.GeocodingService.dataRetrieved(+83)
at com.nutiteq.task.RetrieveNetworkReourceTask.streamOpened(+110)
at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(+319)
at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(+8)
at com.nutiteq.task.RetrieveNetworkReourceTask.execute(+159)
at com.nutiteq.task.RetrieveNetworkReourceTask.execute(+16)
at com.nutiteq.task.TaskWorker.executeTask(+146)
at com.nutiteq.task.TaskWorker.run(+82)
java.lang.ArrayIndexOutOfBoundsException
at com.nutiteq.kml.KmlReader.readPoint(+36)
at com.nutiteq.kml.KmlReader.readPlace(+88)
at com.nutiteq.kml.KmlReader.read(+62)
at com.nutiteq.kml.KmlReader.dataRetrieved(+82)
at com.nutiteq.services.GeocodingService.dataRetrieved(+83)
at com.nutiteq.task.RetrieveNetworkReourceTask.streamOpened(+110)
at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(+319)
at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(+8)
at com.nutiteq.task.RetrieveNetworkReourceTask.execute(+159)
at com.nutiteq.task.RetrieveNetworkReourceTask.execute(+16)
at com.nutiteq.task.TaskWorker.executeTask(+146)
at com.nutiteq.task.TaskWorker.run(+82)
Debug > KmlReader done
Debug > Response read in 334

---
My apps gets null when calling KmlPlace.getWGS() for the POI.
May it be caused by empty 'cat' I sent in the request?

Regards,
Mike

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

Well, it seems that the proxy is broken for this type of queries.

/JaakL

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

Proxy should be fixed now, it seems that cloudmade response had changed a bit, so coordinates were not passed. You must specify cat= value (e.g. cat=cafe) in query to make it work. Query parameter is optional, if you add it then it does additional filtering based on it.

/JaakL

mixa
User offline. Last seen 1 year 1 week ago. Offline
Joined: 01/13/2010

Thanks. Category parameter is actually an integer array, not a string. I can't find info about category types - on cloudmade I see something about object types, not categories (http://developers.cloudmade.com/projects/local-search/examples). Can I get more info somewhere?
Could you provide an example of CloudMadeGeocodingService call for POI? I can't manage that myself, tried several options.
Thanks

mixa
User offline. Last seen 1 year 1 week ago. Offline
Joined: 01/13/2010

When calling
final CloudMadeGeocodingService service =
new CloudMadeGeocodingService(
this, CloudMadeGeocodingService.SERVICE_URL_BASE,
"et", GeoMapComponent.getMiddlePoint(), "cafe",
CloudMadeGeocodingService.SEARCH_TYPE_POI, new int[]{}, 10, false);

I get another problem:
Debug > CloudMade url=http://geocoding.cloudmade.com/BC9A493B41014CAABB98F0471D759707/geocoding/v2/find.js?&query=cafe&return_location=true
Info > Downloading http://geocoding.cloudmade.com/BC9A493B41014CAABB98F0471D759707/geocoding/v2/find.js?&query=cafe&return_location=true
Debug > Connection opened in 512
Debug > Response NOT packed based on first 2 data bytes
Debug > found 21 objects
Error > Error in task runner: null
java.lang.NullPointerException
at com.nutiteq.kml.JsonKmlReader.read(+171)
at com.nutiteq.kml.JsonKmlReader.dataRetrieved(+106)
at com.nutiteq.services.CloudMadeGeocodingService.dataRetrieved(+46)
at com.nutiteq.task.RetrieveNetworkReourceTask.streamOpened(+110)
at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(+319)
at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(+8)
at com.nutiteq.task.RetrieveNetworkReourceTask.execute(+159)
at com.nutiteq.task.RetrieveNetworkReourceTask.execute(+16)
at com.nutiteq.task.TaskWorker.executeTask(+146)
at com.nutiteq.task.TaskWorker.run(+82)
Debug > TW: create new worker

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

Can't comment this issue, as meanwhile we have updated CloudMadeGeocodingService to be as close to full CloudMade service as possible, and this has updated parameter set, see http://www.nutiteq.com/beta/lib/javadoc/com/nutiteq/services/CloudMadeGeocodingService.html

This seems to work with query=cafe. However, you probably want to get object type (in our terms: category) cafe, not something with name cafe, so use objectType=cafe

There is one known issue: the service tries to provide also full geometry of found objects, which looks really cool with street or city searches. But if response becomes too large with too complex polygon objects, then we've got also outofmemory situations, e.g. search Florida (state in US, Argentina etc).

/JaakL

mixa
User offline. Last seen 1 year 1 week ago. Offline
Joined: 01/13/2010

Thanks Jaak, that's what I need (I mean objectType parameter). Where can I find the updated CloudMadeGeocodingService class?

Regards,
Mike

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

nutiteq.com/beta/lib has latest version which should have it. I have not tried with j2me, hopefully obfuscation is ok now.

/JaakL

marshallmaster
User offline. Last seen 1 year 34 weeks ago. Offline
Joined: 04/21/2010

Dear JaakL

when using the new constructor from CloudMadeGeocodingService from the beta lib, I got the error that I need the token. Can you fix this? the same I think with CloudMadeDirections.

thx in advance

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

updated in nutiteq.com/beta/lib android and j2me versions

/JaakL