Skip to content

Instantly share code, notes, and snippets.

@Birne94
Created June 12, 2015 15:22
Show Gist options
  • Save Birne94/44d268b5856bc3dd31b4 to your computer and use it in GitHub Desktop.
Save Birne94/44d268b5856bc3dd31b4 to your computer and use it in GitHub Desktop.
HERE Geocode
var geocodingParams = {
searchText: string
};
var onResult = function (result) {
var locations = result.Response.View[0].Result,
position,
result = [];
// Add a marker for each location found
for (var i = 0; i < locations.length; i++) {
position = {
lat: locations[i].Location.DisplayPosition.Latitude,
lng: locations[i].Location.DisplayPosition.Longitude
};
result.push(position);
}
deferred.resolve(result);
};
var geocoder = hereServices.platform.getGeocodingService();
geocoder.geocode(geocodingParams, onResult, function (e) {
alert(e);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment