Turning Shapes into Maps (Geo JSON) in Einstein Analytics
You are an Einstein Analytics Trailblazer! You love using map visualizations, and have numerous dashboards that show various analytics at the state and country level. You even created a custom map that displays local zip codes (learn how with this Trailhead: Link). You’re happy with these great visualizations, but want to take them to the next level. You dream of a map all the way down to the street level. Can an indoor map be done, you wonder? We are to help! We are here to show you that as long as something has a shape, it can be turned into a map in Einstein. The possibilities are literally endless! We will walk you through how to create a street-level map and an indoor map.
For our street-level map, let’s imagine we want to analyze rent prices in the trendy local neighborhood. Here’s what you need to do.
The first step is to turn the map of the neighborhood into a GeoJSON file. Luckily, there are online tools that do the trick for you. One tool we like to use is Mapzen (https://mapzen.com/data/metro-extracts/), where you can select any metro area in the world and turn it into a GeoJSON file. This will show all the buildings in the area you selected.
Next, search for the neighborhood you want to generate the map for on the Mapzen website. You will find that many neighborhoods are available for pre-selection.
Then, filter to the selection you want and press “Get Extract” to extract your file to GeoJSON format. Once the extract is completed, download it into GeoJSON format by geometry type. Check the file on a JSON editor to ensure that it is correct. In this instance, you are good to go!
The next step is to load the map into Einstein Analytics. To do that, log into Salesforce. Append /analytics/wave/web/custommap.apexp to the URL after “.salesforce.com”. The complete URL would look something like the following, with na35 replaced by your org’s instance: https://na35.salesforce.com/analytics/wave/web/custommap.apexp.
On the custom map page, click New to create a new map, enter a label and name, and select the GeoJSON file you created. Click Insert.
Next, give the map a label and name. Select Equirectangular as the Projection and the GeoJSON you just inserted. Keep the Bounding Box selections empty. Click Insert Map. You are now ready to use your new Map as a visualization in Einstein Analytics!
After loading a dataset with the monthly cost for a one-bedroom for all apartments in the neighborhood, create a new lens that sums the rent cost by the apartment name. Change the visualization type to a map, and change the Map Type to Custom: Your Map Name. Your visualization will now show rent costs in the neighborhood. The darker the shade of pink, the more expensive the apartment is.
For our second example, we are going to cover how to use an indoor map in Einstein. With an indoor map, we can display things like a stadium, an airport, a museum, a hospital or a school. For this example, let’s imagine we want to analyze sales for all stores in a shopping mall.
Like in the previous example, you’ll need to convert your indoor map to GeoJSON. Depending on the format of your file, you may be able to convert it directly to GeoJSON. An overview of file converters to GeoJSON can be found here: http://techslides.com/image-to-svg-to-geojson-converters.
Once you have the GeoJSON, the next steps will be the same as in the previous example. Go to the custom map URL and insert your GeoJSON and the map. After importing a file that illustrates revenue by store, set up your lens to show sum of revenue by store name. Switch the visualization type to map and change the map type to your new custom map. Your visualization now shows revenue by store.
As you can see, maps in Einstein Analytics can be very powerful. The standard state, region and country maps you get out of the box are just a drop in the bucket of what is possible. All we need is a shape to turn something into a map. Need help with unleashing the fury of maps in your dashboards? Contact us to take the next steps towards building truly powerful map visualizations.