Giter Site home page Giter Site logo

google-maps-place-crawler's Introduction

Google Maps Place crawler

Node.js script that uses the Google Places API to programmatically retrieve and compile a list of Places (e.g. businesses) in a given area. Data can include place/business name, address, website, phone number, latitude/longitude, and more. With this script you can retrieve data on any number of places, up to the limit of your Google Maps API key.

See it on npm: npmjs.com/package/google-maps-place-crawler

Usage

Install from npm:

$ npm install google-maps-place-crawler

Require the package. Here we will store it in the variable GoogleMapsPlaceCrawler.

const GoogleMapsPlaceCrawler = require('google-maps-place-crawler')

Set your Google Maps API key in the same object:

GoogleMapsPlaceCrawler.apikey = 'YOUR_API_KEY'

Go here to set up your key: https://developers.google.com/places/web-service/


You have two methods you can use:

Nearby search

placeNearbySearch(latitude, longitude, search radius)

This async function searches for Places in a specified radius from the given coordinates. It can return up to 60 places (this limit is due to the Places API). Search radius should be in meters. 1 mile ~ 1600m.

Example:

GoogleMapsPlaceCrawler.placeNearbySearch(33.640864, -117.720336, 50).then((data) => {
    // do something with data
    console.log(data);
});

Area search

searchArea(start latitude, start longitude, end latitude, end longitude, search radius)

This async function runs placeNearbySearch many times in order to cover a large rectangular area. Search radius should be in meters.

Example:

GoogleMapsPlaceCrawler.searchArea(33.638684, -117.721065, 33.641078, -117.719273, 100).then((data) => {
    // do something with data
    console.log(data);
});

The search area is a rectangle defined by the start coordinates and the end coordinates, which are opposite vertices on the diagonal of the rectangle. The start coordinates are the lower left vertex, and the end coordinates are the upper right vertex.

In this function the search radius should reflect the expected density of Places in the area. If there are more than 60 Places within one of the searches done by placeNearbySearch (i.e. search radius is too large), the rest of the Places will not be captured in that search. You would also not want to set this value too low, because that will make the script take longer and use more requests of the Google API. I think 100 meters is a good, safe value for an area that might be dense with Places.

Instructions and example usage are also given in help.js

google-maps-place-crawler's People

Contributors

michaeljwilliams avatar

Stargazers

Trevor Hedley avatar Teddy Einsidler avatar Huub avatar Tell Moitas avatar huutho.dev avatar Van Minh Hoang avatar snoop2head avatar SeungHeon Doh avatar Abdulaziz Alkharashi avatar Eda Eser avatar Marcos Vinicios Pagelkopf junior avatar  avatar João Paulo de C. Lima avatar CodeMasterChef avatar Olimar Ferraz avatar Summit Suen avatar Huy Nguyen avatar

Watchers

James Cloos avatar  avatar huutho.dev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.