GeoCode

Calculate or find latitude and longitude values (and store them in new columns) from a column containing geographical locations. The new columns can be generated from the following columns in the table: country, state, county, city, and zip/ post code. Once you input these columns, Pyramid connects to its internal "pagis" database in order to convert the locations in the source column into latitude and longitude coordinates, returning those coordinates in 2 columns that end users can add to queries. This is especially useful for creating map visualizations in Discover.

Why GeoCode in the Data Flow?

Pyramid can perform geocoding in 2 ways:

  1. Geocode on the fly in Discover.
  2. Add latitude and longitude columns to the data model, which can then be used to drive map visualizations.

When creating map visuals in Discover, without adding GeoCoding to the model, you can add the required location names and Pyramid converts them into locations on the map by finding their latitude and longitude coordinates. Pyramid does this by searching for the latitude and longitude of the given locations in the 'pagis' database. If the locations aren't found there, it searches for them using Mapbox. This type of geocoding can be useful because it doesn't require any prior geocoding; Pyramid does the geocoding for you on the fly. On the other hand, this process can impact on map performance.

The other method of geocoding is done via the GeoCode function in the Data Flow. Using this method, Pyramid searches for the locations in the given columns in the pagis database, and returns the latitude and longitude for each location for which there is a match. The new latitude and longitude columns are then saved in the data model, and can be used in map visuals in Discover. Adding latitude and longitude coordinates to queries improves the speed of maps, because Pyramid doesn't need to perform any geocoding at runtime.

How to Configure a GeoCode Node

Connect the GeoCode node to the Select node representing the relevant table. Go to the Properties panel to configure the node:

  • Country Column: select the column containing countries.
  • Default Country: enter the default country from the country column.
  • State Column: select the column containing states.
  • County Column: select the column containing counties, if relevant.
  • City Column: select the column containing cities.
  • Zip/ Post Code Column: select the column containing postal codes.

In instances where no match is found for a row in the Pyramid internal data base (see above), the latitude and longitude cells for that row will be blank.

GeoCoding from Scripts

You can also perform GeoCoding using Python or R scripting. This can be done by providing your own script, or by downloading a script from the Pyramid Marketplace. Currently, you can download the following Python GeoCoding scripts from the Marketplace:

  • Geo Distance
  • Geo Distance from Central Location
  • Country from Address
  • Address from Coordinates
  • Coordinates from Address