Art of Possible: Building Custom Maps in Wave
Analytics and analytical dashboards are no longer about overloading the user with loads of numbers and metrics in daunting tables and spreadsheets; today they need to tell a story, which makes effective visualization very important. Good analytics increase curiosity and help discover second-order insights and questions. Salesforce Wave enables users to interact with their data visually via the rich Wave Charting library, which not only exposes the right visuals, but also includes interactions, animations etc.
This is important, because the rapid growth of data has been accompanied by a profile shift of the users digging through the data, from data analyst to business user. With that change comes an increasing emphasis on the appropriate visualization for the data in question. For example, if you’re trying to slice-and-dice data by geography, then visualizing the data as a map is the best way. On that note, the Wave team recently added Maps to our portfolio of charts to help better visualize and represent your geo data.
In the Summer ’16 release we’ve added support for thematic maps, or choropleth maps, out-of-the-box. These maps have shaded-in areas proportionate to the data being displayed on the map, allowing for visual focus on high-value areas. Traditionally, maps are used to visualize population density or total sales, but you could easily extend it to signals from an IoT device, tweets etc., as well. Maps can portray various aspects (geological, political, economic) of a geographical entity, be it city, state, or country. Wave’s out-of-the-box implementation supports a world map broken down by country and regions (eg. Americas), and a United States map broken down by state.
In addition to out-of-the-box support for a few maps, Wave is also providing users with the ability to create their own map visualizations via GeoJSON. These GeoJSONs don’t need to be limited to geographical maps, it could be a stadium or floor map. Basically anything that can be described as a polygon shape can be viewed as a map. Imagine this: As a retail company or a store manager you are trying to be more efficient about stocking or even pricing your products. You could visualize the sales of your items broken down by which rack you place the items on or which area of your store you place those items and model related data visually.
What if you were able to visualize your ticket sales at a venue visually? .
No more spreadsheets or numbers to go through to actually get meaning from this data. Wave lets you explore the art of possible with our Custom GeoJSON functionality!
WARNING: As of Winter ’16, Custom Maps is a pilot feature. A special permission needs to be enabled on your org in order to access it. Please contact your salesforce representative or Kim Chouard for more information.
GeoJSON is a standardized way of passing information in a JSON format to describe polygon shapes that will be drawn. There are a bunch of tools available online:
We’ll use Mapshaper in the section below.
Create Your Own Custom GeoJSON
Let’s walk through how to create a new World Map containing your business regions. Something like this:
Step 1: Load the default GeoJSON
You’ll need the following files to get started:
- The default World Map GeoJSON from Wave ( this comes out of the box, you don’t need to do anything!)
- A CSV mapping each World Country to a Region. It should be shaped this way:
|United States of America
You can download an example here [ source ].
The goal is to merge all the country shapes from the same regions together. To do so, we will use a tool called Mapshaper. An online version is available here: http://www.mapshaper.org/
Drag and drop both your GeoJSON and CSV files in there:
The menu on the top will allow you to switch from viewing the GeoJSON to the CSV. Make sure you’re on the “world-countries” GeoJSON. You should be able to see the world map:
Tip: You can click on to see shape metadata when hovering on it.
Step 2: Create a Custom GeoJSON
Now that we have our files loaded, let’s merge our country shapes by running those commands:
-join Countries-Regions.csv keys=FID,alpha-3 fields=region
Voilà! You should see the new borders in black and the dissolved ones in green.
So what did this script did exactly?
- It imported the region information into the GeoJSON
- It used it to merge the shapes based on similar regions
- Finally, it renamed the metadata “region” into “name”.
Warning: In order to be mapped to the data by Wave, the custom map shapes has to have a name information.
Step 3: Downlaod the Custom GeoJSON
You can now click Export the world-countries layer in GeoJSON format. That is the file you will import into Wave.
Step 4: Import the Custom GeoJSON
Now that you have your GeoJSON, it’s time to import it into Wave. A Wave map is composed of two elements:
- A shape definition in GeoJSON format.
- A map that use a shape with bounding boxes to set the field of view/zoom.
- Login into your Salesforce Organization and open Wave Analytics.
- In this step you change the URL in the address bar. Replace the “ explore.apexp” with “ custommap .apexp” in the URL, to access (…).salesforce.com/analytics/wave/web/custommap.apexp:
Step 5: Create a Map
You now have to import the GeoJSON and create a map out of it:
- Click New.
- Import your GeoJSON.
- Type a GeoJSON name.
- Choose your GeoJSON file.
- Enter a developer name. Warning : the developer name should contain only letters.
- Click Insert.
- You should have a success message stating that it has “Successfully inserted new GeoJson”.
- Create a new custom map.
- Leave the bounding boxes fields empty.
- Type your map name.
- Pick Mercator as your projection. Note: Mercator is a projection used in world mapping. You would pick Equirectangular for non-world related maps like the Levi’s stadium above.
- Choose your GeoJSON.
- Click Insert Map.
You are now able to use this new map in your dashboards. For example, we could map the world population based on the wikipedia data :
You know now the building blocks on how to create a custom maps in Wave. You could use that to create your own subregions, US county maps or create a map from scratch. You can even create an Alpha2 compatible map using the dataset above.
Explore the Art of Possible
Wave gives you the ability to experience data and interact with it visually. This provides new insights and the ability to make decisions. Data can be fun, and we look forward to enabling meaningful data explorations for our customers with the power of custom GeoJSON.
About the Authors
Amruta Moktali is a Product Queen ☺ ( Sr. Dir Product Management) on the Analytics Cloud always looking for ways to revolutionize how customers can get value from technology.
Kim Chouard is a Product Manager on EclairNG, Wave new charting engine. Professional high-fiver, he is passionate about education and building exciting products.