diff --git a/Geocoder.js b/Geocoder.js index b9f5dfb..f30ab80 100644 --- a/Geocoder.js +++ b/Geocoder.js @@ -56,6 +56,10 @@ export default Geocoder = { else if (params[0] instanceof Array) queryParams = {latlng : `${params[0][0]},${params[0][1]}`}; + // {place_id} + else if (params[0] instanceof Object && params[0].hasOwnProperty('place_id')) + queryParams = {place_id : `${params[0].place_id}`}; + // {latitude, longitude} or {lat, lng} else if (params[0] instanceof Object) queryParams = {latlng : `${params[0].lat || params[0].latitude},${params[0].lng || params[0].longitude}`}; diff --git a/README.md b/README.md index f05760a..00a0bf1 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,12 @@ Geocoder.from({ // array Geocoder.from([41.89, 12.49]); + +// object with place_id, provided by Google Places Api +Geocoder.from({ + place_id: 'ChIJgUbEo8cfqokR5lP9_Wh_DaM' +}); + ``` # Error Codes