npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

datocms-plugin-address-autocomplete

v1.2.0

Published

A React-based implementation of Google's Address Autocomplete API, for DatoCMS.

Downloads

6

Readme

DatoCMS Address Autocomplete

This plugin is a React-based implementation of Google's Address Autocomplete API, for DatoCMS.

Results will be saved as a JSON object, with granular fields that allow you to query for data such as city, state, and geocoordinates. For example:

{
  "street_number": "11701",
  "route": "Elevation Pt Dr",
  "neighborhood": "Ballantyne",
  "locality": "Charlotte",
  "administrative_area_level_2": "Mecklenburg County",
  "administrative_area_level_1": "NC",
  "country": "US",
  "postal_code": "28277",
  "name": "Elevation Church - Ballantyne",
  "formatted_address": "11701 Elevation Pt Dr, Charlotte, NC 28277, USA",
  "coordinates": {
    "lat": 35.02993079999999,
    "lng": -80.8557278
  }
}

But, why?

There are several reasons why we created this plugin:

1. Data integrity

Content creators were typing in addresses in plain text fields, which of course led to mistakes.

2. Frontend capabilities

We wanted to be able to link to Google and Apple Maps on the frontend, but couldn't reliably do so without the possibility of linking to an incorrect address.

There's also the ability to display any part of the address, without being hacky (i.e., parsing a full address and trying to extract city, state, etc).

3. Sorting by geocoordinates

We'd like to present a user with events closest to them. Now, we can trust that the geocoordinates stored in our DB directly point to the location the event is happening in, rather than looking them up by address on the frontend.

Geocoordinates are also passed directly to our search engine, meaning that it does all the sorting for us. Win-win.

4. User experience

Our content creators can quickly and confidently enter addresses. No more copy-paste-verify.

Prerequisites

First off, you'll need to obtain an API Key from Google Cloud. This README won't cover those steps, but here's a friendly reminder that you will need to enable to following Google Cloud services in order for it to work:

  • Maps JavaScript API
  • Places API

Installation

Here's a link to this plugin's page on the DatoCMS Marketplace, in case you are reading this somewhere else. Just click on "Install this plugin!" from teh Marketplace and select the appropriate DatoCMS project to associate it to.

Configuration

There is only one (required) setting, and that's your Google Cloud API Key.

To use this plugin, create a JSON field, and under Presentation, change the Field editor property to Address.

Internationalization

You can also choose to receive results in a language other than English at the field-level. Please consult the list of possible languages, provided by Google Maps.

When adding or editing the field in your model, visit the Presentation tab and use the dropdown menu to select a different value for the language. You will now see results in a different language based on what Google Maps provides.