Skip to content

To search nearby place, get geolocation, place image and place details. (Repo for NPM)

Notifications You must be signed in to change notification settings

abhishek11210646/Place-search-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Place Search

Search for near by place, get geolocation, place images and place details

Installation

$ npm i place-search-sdk

Usage

Note: You'll need to Enable place API key in google developer console(https://console.developers.google.com/).

const googlePlace = require('place-search-sdk');

const client = new googlePlace('API-KEY')

Geolocation

client.getGeoLocation('jalandhar')
	.then(latlong => {
		/*
        	{
        	    lat: 30.05758,
        	    lng: 31.94734
        	}
		 */
	});

Near By Search

client.nearBySearch({geoCode: {lat:30.097575, lng: 31.3784737} , searchType: 'restaurant'})
.then(result=>{
    /*[{
         return all places with details title, place id, photo reference, geomatric location, rating etc etc.
        	name:
            icon:
            rating:
            photo_reference: 
            address: 
            placeId: 
        }]
	*/
});

Place Image

photo_reference is a id returned by nearby search.

client.getPlaceImage('photo_reference')
	.then(result=>{
    /*[{
        	   will return image of place.
        }]
	*/
});

Place Details

placeId is a id returned by nearby search.

client.getPlaceDetails('placeid')
	.then(result=>{
    /*[{
        	will return all details of a place. like
        	address: 
            phoneNumber: 
            phoneNumberInternational: 
            rating: 
            website: 
            utc_offset:
            photos: 
            reviews: 
            opening_hours:
        }]
	*/
});

About

To search nearby place, get geolocation, place image and place details. (Repo for NPM)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%