Trying to geocode and add markers from array of addresses
Hey there you guys, you are all developing quite above my level but I gots me one of them NOOB type questions :rolleyes:
I have an app that is fetching an array of addresses like (street, city, state).
Unfortunately I don't have the lat,long for these and I want to plot these all on the same map.
All of the examples I have found on the net (over the last 4 hours of research) get me close, but they all involve, events like keypress and submitting the address through a form, then it displays on the map.
Reading the code, there is a lot of extraneous lines used to convert the click events and stuff and I just wanted to know a simple way to iterate through this array of addresses and plot them.
Anyone care to offer some ideas?
Thanks code poets,
MG
Re: Trying to geocode and add markers from array of addresses
What technology and language are you using for development ? Wiki would have at least Qt Maps examples, which also are including geocoding examples..
Re: Trying to geocode and add markers from array of addresses
Hi MGunner, Welcome to Nokia Developer Discussion Boards!! :)
Just to add what Yukka mentioned :
Java and Qt Location articles and code samples are available here [url]http://www.developer.nokia.com/Community/Wiki/Category:Location[/url]
Regards
Gopal
Re: Trying to geocode and add markers from array of addresses
Well, I have stripped down the developer's playgrond example and have a result.
It's a hack but it's a start.
Before I cycle in an array of addresses, I think I need to add to this code to make it less sloppy (of a request).
Eventually, i want to send anywhere from 1-30 addresses for geocode lookup, I hope I can do that in a JSON request.
Also looking to center the map on the first resturned geocoded value.
Here's the code if you want to take a look:
var map = new ovi.mapsapi.map.Display(mapContainer, {
center: [53, 13],
zoomLevel: 3,
components: [new ovi.mapsapi.map.component.Behavior()]
});
var searchManager = new ovi.mapsapi.search.Manager();
searchManager.addObserver("state", function(observedManager, key, value) {
if(value == "finished") {
if (observedManager.locations.length > 0) {
rs = (new ovi.mapsapi.search.component.SearchResultSet(observedManager.locations)).container;
//push markers to map
map.objects.add(rs);
map.zoomTo(rs.getBoundingBox(), false);
}
} else if(value == "failed") {
alert("The request failed.");
}
});
searchManager.geocode("12825 W Sunset Hwy Airway Heights, WA 99001");
Re: Trying to geocode and add markers from array of addresses
Hi there, MGunner
Please check out this topic, it handles what you are seeking for.
[url]https://projects.developer.nokia.com/ovimapsapi/discussion/topic/95[/url]
Direct link to the wiki article referring: [url]http://www.developer.nokia.com/Community/Wiki/Ovi_Maps_API_-_Performing_multiple_consequent_Search_requests[/url]
Best,
Marko