Adding a Map#
It can be useful sometimes to visualize lists of locations on a geographic map.
Grist can do that if a table has at least a
Suppose we have a list of some of the largest objects in America:
The first step to making a map for these is to add a Custom Widget to the page:
Once we set the widget to be
and give it
Read table access, a map should appear:
Clicking around in the list of objects brings up the corresponding “pop-up” on the map. We can add other sections to taste, such as a detail “card” view of the attraction’s details. This example is available at https://public.getgrist.com/3boQPJrgFmFi/Large-in-America/m/fork.
This example has some hidden columns related to geocoding (the process
of automatically calculating coordinates from addresses). You can see
these on the second page called
Geocoding. They are
GeocodedAddress. If you would like to use geocoding,
you’ll need these three columns, and to grant the map widget full
access to your document so it can store results.
hold exactly what you want to pass to the geocoder. In the example,
it is simply
", ".join([$City, $State]). The
be left untouched; it is a space for the geocoder to store information.
Geocode is a toggle that should be turned on to automatically
generate latitude and longitudes.
The geocoder will not touch any rows
Geocode turned off. When
Geocode is turned on for a row,
latitudes and longitudes are computed and stored automatically for that row
Nominatim’s Usage Policy
allows for limited, non-bulk creative use.
Robust geocoding generally requires an account with an external service and a secret API key.
We expect to soon have a convenient way to store secrets in a document,
and will then be able to support flexible geocoding options. If you are
interested in previewing this feature, please get in touch!
Finally, if you know some HTML/CSS/JS, or have a web developer on your team, you’ll find the map custom widget simple to restyle as you like. If you need a hand, just let us know.