Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #36 from tylermachado/master
Browse files Browse the repository at this point in the history
adding Yandex geocoder (now with merge conflicts resolved)
  • Loading branch information
tmcw authored Jul 19, 2016
2 parents 7652708 + ea9aaee commit 285ae59
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions MapBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ var geocoders = {
}
}
},
yandex: {
query: function(query, key) {
return 'http://geocode-maps.yandex.ru/1.x/?format=json&results=1&geocode=' + query + '&lang=en-US';
},
parse: function(r) {
try {
return {
longitude: r.response.GeoObjectCollection.featureMember[0].GeoObject.Point.pos,
latitude: r.response.GeoObjectCollection.featureMember[0].GeoObject.Point.pos,
accuracy: r.response.GeoObjectCollection.featureMember[0].GeoObject.metaDataProperty.GeocoderMetaData.precision
}
} catch(e) {
return { longitude: '', latitude: '', accuracy: '' };
}
}
},
mapquest: {
query: function(query, key) {
return 'http://open.mapquestapi.com/nominatim/v1/search?format=json&limit=1&q=' + query;
Expand Down Expand Up @@ -232,6 +248,7 @@ function gcDialog() {
.setId('apiBox')
.addItem('mapquest')
.addItem('yahoo')
.addItem('yandex')
.addItem('cicero'));
grid.setWidget(1, 0, app.createLabel('API key:'));
grid.setWidget(1, 1, app.createTextBox().setName('keyBox').setId('keyBox'));
Expand Down

0 comments on commit 285ae59

Please sign in to comment.