-
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-demo
CARTO 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-UPS
andLEGENDS
.
-
DATA
:- Switch to
VALUES
toSQL
- map view to dataset view.
- Switch to
-
STYLE
:FILL
: click on the marker size, selectBY VALUE
, settotal_damage
as the variable and choose a color.- Change the
STROKE
to 0. - Switch to
VALUES
toCARTOCSS
. 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 onCONTINUE
and setOPERATION
tosum
and 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 theSEARCH
bar, select thecb_2013_us_county_500k
dataset and finally, click onADD LAYER
. - Rename the new layer to "US Counties".
-
Select
Intersect second layer
:- Select "Railroad accidents" as
TARGET LAYER
andSUM(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
DATA
section, check theAdd as a widget
box of thesum_total_damage
field andEDIT
. This will create a new histogram widget. Set the buckets to7
and 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_damage
asTARGET COLUMN
and 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
,Category
and selectquads
.CONTINUE
. Rename it as "Groups". -
Filter by
HH
andHL
counties. 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 style
to 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_geom
column. You should have 39 counties/rows, containing onlyHH
andHL
values.
- Below the map title it should show
PRIVATE
,ADD PEOPLE
andMap 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
STYLE
tab. Style the layer with aFILL
BY VALUE
. Selectquads
as variable and choose a couple of colors that can be easily distinguished. - Click again on
SHARE
and 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.