gridsome-source-gmaps-geocode

1.0.3 • Public • Published

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
        }
      }
    }
  }
}

Package Sidebar

Install

npm i gridsome-source-gmaps-geocode

Weekly Downloads

24

Version

1.0.3

License

none

Unpacked Size

2.94 kB

Total Files

3

Last publish

Collaborators

  • iam-jam