-
Degree of Difficulty: ***
-
Goal: what US counties have higher risk for insuring railroad companies.
-
Features Highlighted:
- Widgets: Category, Formula and Time Series.
- Analysis: Intersect, Outliers & Cluster analysis.
-
Datasests needed:
- Railroad accidents (
dot_rail_safety_data): download it from thebuilder-demoCARTO account and import it into CARTO from your local machine. - US counties (
cb_2013_us_county_500k): search and connect via Data Library.
- Railroad accidents (
- Importing files into CARTO is easy! A wide diversity of geodata is supported in CARTO during the importing.
You can import directly to your Map dashboard as a .carto file and skip this step.
- Main menu/sections of the Builder.
- You should have a dashboard like this:
-
Basemap
-
Layers
5 options:
DATA,ANALYSES,STYLE,POP-UPSandLEGENDS.
-
DATA:- Switch to
VALUEStoSQL - map view to dataset view.
- Switch to
-
STYLE:FILL: click on the marker size, selectBY VALUE, settotal_damageas the variable and choose a color.- Change the
STROKEto 0. - Switch to
VALUEStoCARTOCSS. The CartoCSS command line allows more advanced users to layer style in a more precise way. turbo-carto
ADD WIDGET:- Railroad Companies Category Widget: select
Category, chooserailroad, and click onCONTINUE. In order to rename the widget, come back to the list of widgets and double click on the name and rename it as "Railroad Companies".
- Railroad Companies Category Widget: select
- Total Damage Formula Widget: select
Formula, choosetotal_damage, and click onCONTINUEand setOPERATIONtosumand add$asPREFIX. In order to rename the widget, come back to the list of widgets and double click on the name and rename it as "Total damage".
- Date Time Series Widget: select
Time Series, choosedate, and click onCONTINUE. In order to rename the widget.
If you have imported the map as a .carto file please skip this step.
- Click on
DATA LIBRARY, type "counties" on theSEARCHbar, select thecb_2013_us_county_500kdataset and finally, click onADD LAYER. - Rename the new layer to "US Counties".
-
Select
Intersect second layer:- Select "Railroad accidents" as
TARGET LAYERandSUM(total_damage)asOPERATION. Apply. - When the analysis is done, an explanatory window will pop up. Click on
DONE.
- Select "Railroad accidents" as
-
First, using the map show the viewer the results of the analysis: only the counties overlapping with data points are showed. Secondly, go to the dataset view to show the new column created with the previous analysis,
sum_total_damage.
-
Sum Total Damage Histogram Widget: from the same
DATAsection, check theAdd as a widgetbox of thesum_total_damagefield andEDIT. This will create a new histogram widget. Set the buckets to7and rename it as "Sum Total Damage". -
Use the autostyling and removing the visibility of the "Railroad accidents" layer. Remove auto style again. Go back to the main menu.
- Select
Detect outliers and clusters:- Select
sum_total_damageasTARGET COLUMNand leave the rest of parameters with the default values. Apply. - Again, when the analysis is done, an explanatory window will pop up. Click on
DONE.
- Select
-
We are going to add a last widget, Sum Total Damage Histogram Widget: click on
WIDGETS,ADD,Categoryand selectquads.CONTINUE. Rename it as "Groups". -
Filter by
HHandHLcounties. Those are counties with high value of total damage surrounded by counties with also high values, and counties with high value of total damage surrounded by counties with low values. Click onAuto styleto better distinguish them. Remove the auto style.
- Select
Export data, chooseCSV. - Open (with Excel or another similar software) the csv file you just download
US_Counties.csv. Collapsethe_geomcolumn. You should have 39 counties/rows, containing onlyHHandHLvalues.
- Below the map title it should show
PRIVATE,ADD PEOPLEandMap not published yet. Let's change that.- First, click on
PRIVATE, and again. SelectLink. - Secondly, click on
SHARE(at the bottom of the main menu). Click onPUBLISH, and thenDONE. - Get the link and past it into your browser.
- First, click on
The dashboard should show your "Railroad accidents" as green dots with sizes depending on the total damage. In addition, all the groups of counties will be displayed. This is because the filters and auto styling you did, it is not applied. Finally, you will have four widgets but in different order.
- Back to the main menu, click on "US Counties" layer. Go to the
STYLEtab. Style the layer with aFILLBY VALUE. Selectquadsas variable and choose a couple of colors that can be easily distinguished. - Click again on
SHAREand now inUPDATE. - Now if you go back to your browser tab where you have pasted the link nothing has changed. But if you refresh the page, voilá! The colors have modified.











