Skip to content

Gridsome source plugin to geocode your data using the Google Maps Geocoding API 🗺️

Notifications You must be signed in to change notification settings

j4-m/gridsome-source-gmaps-geocode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gridsome-source-gmaps-geocode

Install

yarn add gridsome-source-gmaps-geocode

Or

npm install --save gridsome-source-gmaps-geocode

Usage

Configure the plugin in your gridsome.config.js

module.exports = {
  ...
  plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {
        path: '_content/**/*.md',
        typeName: 'Office'
      }
    },
    {
      use: 'gridsome-source-gmaps-geocode',
      options: {
        apiKey: 'your-gmaps-geocode-api-key-here',
        sourceTypeName: 'Office',
        sourceTypeField: 'address'
      }
    },
  ]
}

You will then be able to use access the gecode result for the value of the address field on each Office node via the geocode field on Office nodes:

{
  allOffice {
    edges {
      node {
        geocode {
          lat
          lng
        }
      }
    }
  }
}

About

Gridsome source plugin to geocode your data using the Google Maps Geocoding API 🗺️

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published