Skip to content

Instantly share code, notes, and snippets.

@mehak-sachdeva
Last active September 28, 2016 14:17
Show Gist options
  • Save mehak-sachdeva/ae38a63dab59d010a7dee625bfd5e171 to your computer and use it in GitHub Desktop.
Save mehak-sachdeva/ae38a63dab59d010a7dee625bfd5e171 to your computer and use it in GitHub Desktop.

Analyze and Edit using CARTO Builder!

As an introduction to the Builder, the easiest way to delve into the analysis and get accustomed to the new interface is to complete this guided lesson. This lesson, consiting of exercises and subparts, can be accomplished through a CARTO account. The 5 exercises have been defined in a manner that let you go through in a systematic manner to create the following and similar spatial analysis, given the dataset you are exploring and the question you wish to ask with your data.

Have you ever found yourself start with a rich dataset but often at a loss of direction for the questions that can solved through that data? Or inversely, with an insightful question that you wished you could explore with data and analysis, but aren't sure where to begin? We at CARTO, are striving to approach these gaps and through these guided lessons wish to help achieve just that. In this lesson, we explore the question "Which Starbucks stores are the closest to subway stations in Manhattan?". Through a few simple steps in builder, we can answer this question and begin to explore insights into marketting and analysis through our data. For ease in learning, we recommend completing the entire tutorial in sequence and to follow the exercises in a continuous format to build on top of each of these, in order to finally complete the following (or similar) map analysis!

###Overview of Exercises

Step 1: Importing a Dataset and Creating a Map : This exercise introduces the concept of importing multiple datasets and creating a map based on that. You will learn how to import a shapefile, add multiple layers, rename and manage layers and create a simple map with that.

Step 2: Layers and Styles : This exercise emphasises on the ordering of layers in the Builder, to explore various styling options within the Builder and see what options are available within the data interface to handle your data.

Step 3: Analysis : This exercise introduces and helps you apply the different analysis methods necessary and relevant for answering your specific questions. In this particular case, we delve deeper into 'Areas of influence' and 'Filtering points based on geometry' methods of analysis.

Step 4: Communicate and highlight your results : This exercise helps explore the cartographic solutions to highlight and emphasize your results from the analysis in order to communicate the analysis in a more effective and depictive manner.

Step 5: Exporting and Sharing Results : This exercises aims toward exploring the ways you can export your results and enable sharing with your team or at large with the media!

Step 1: Importing a Dataset and Creating a Map

Import the files subwaystations and starbucks_locations into your Carto account by drag and dropping them into the Dataset Dashboard, or pasting the URL into the Import dialogue

show little boxes for links to the files

  • Show how easy is to import files into CARTO! Explain the viewer the wide diversity of geodata supported in CARTO during the importing.

  • GIF showing the METDATA-SQL switch and the PREVIEW.

Next, in the Dataset Dashboard, click both of the new datasets so they are highlighted. Then click "Create Map" so we can start mapping this data.

To organize our map better, rename the map to Builder Quickstart by double-clicking the map name at the top of hte left pane.

Re-name the individual layers by going into their individual editor pages as you see in the video.

Warning: after renaming a layer a error could pop up saying "the map cannot be rendered", don't worry about this. Refresh the page and it will dissapear.

  • You should have a dashboard like this:

Step 2: Layers and styles

Now let's apply more customization to the map. Start by changing the basemap to "Dark Matter (labels below)" by clicking into the basemap (the bottom layer of your map), and selecing the appropriate icon.

In the layers menu, you can see that each layer has a different label. The first layer added to the map, subwaystations, will have label "A" and be referenced as a0, which we will see is important when constructing analysis chains. This labeling is also important when using the widgets.

Layer options

Each layer has 5 options: "DATA", "ANALYSES", "STYLE", "POP-UPS", and "LEGENDS". Here we will look at Data and Style.

The DATA tab gives a general view of the data within the dataset such as column names, type of data (number, string, etc.), and access to widgets. The SQL panel, which allows for advanced querying of the data, is also accessible from this tab. In the lower center of the map, you also have the option to go between the map and data views. We will not be needing any customization from this tab for now.

The STYLE tab gives controls for visualizing the data on your map. Here

  • For layer subwaystations set the FILL property a size of 7 and color #0033ff and for the layer starbucks set the FILL property a size of 7 and color #FFB927.
  • For both layers set the STROKE property a size of 1 and color #000000.
  • Switch to VALUES to CARTOCSS. Explain that the CartoCSS command line allows more advanced users to layer style in a more precise way.

Step 3: Adding analysis

Area of Influence analysis

  • Back to the main menu of the layers, select the subwaystations layer and click on ADD ANALYSIS option.

  • From the analysis menu, select the Create areas of influence analysis and click on ADD ANALYSIS.

  • In the ANALYSES tab of the layer, we have three sections:
    • Workflow: Is an overview of the analysis that we apply to the layer, so you can have more than one. The analysis should have the name A1 to indicate that is the first analysis applied to the layer.
    • Input: asks for the geometry where we will calculate the area around the points of the subwaystations layer.
    • Parameters: define the distance of the area of influence, the type of units, the radius and the boundaries. The boundaries might be intact or dissolved. If we choose the intact option, that means that if our areas of influence polygons overlap, then they will keep their original polygon borders. On the other hand, if we choose the dissolve option, if the areas of influence polygons overlap, they will be merged so the result will be one big polygon. We set the units to meters,set the radius to 100 and choose the intact option for the boundaries.
  • After clicking Apply, we should see a result where we can see the areas of influence of 100 meters around the subway stations:

Filter points in polygons analysis

  • Before applying the analysis, we will hide the the starbuck layer in order to have a better visualization of the results of the analysis.
  • We will apply the analysis to the subwaystations layer, so we click ADD ANALYSIS option of that layer and we select the Filter points in polygons option.

  • In the ANALYSES tab of the layer, we have two sections:
    • Workflow: Now, because we are applying a second analysis to the subwaystations layer, the workflow has changed. A1 represent the area of influence analysis, but now we have a new analysis named A2 to indicate that is the second analysis applied to the layer.
    • Filter points in polygons:
      • Source: we indicate that we are using as the source, the results from the area of influence analysis. The source is not the original points of the layer, but the polygons that we got after the area of influence analysis.
      • Target Layer: is the starbucks layer.
  • After clicking Apply, we should see a result where we can see the starbucks stores that are within 100 meters from the subway stations.

Step 4: Communicate and highlight your results

  • We can improve our map by making the relation between starbuck stores and subway stations more obvious by clicking the area of influence analysis of the subwaystations layer in the main menu and dragging and dropping it outside the layer. That will create a new layer that it will have the same name as the original one.
  • We change the name of the new layer to stationareas.

(Note: This exercise will typically contain more steps exploring cartography depending on the use-case)

Step 5: Export results

  • We can get a list of the starbuck store locations that are within 100 meters by selecting the Export data option of the subwaystations layer. We can export it as a .csv file and open it to check the directions of the stores that are within 100 meters from the subway stations.

(Note: This exercise will typically contain more steps exploring sharing/embedding depending on the use-case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment