GEOG 865
Cloud and Server GIS

Aggregating points to boundaries of another dataset


Let's see what the spatial distribution of CSA dropoff points looks like when aggregated to Portland neighborhoods. We'll then put some popups on each neighborhood and share the map in a way that others could easily view it on the web.

  1. Go back to your home page (logged in), click Datasets, and upload the neighborhood_boundaries.geojson file located in your lesson data folder.
  2. Create a map out of the neighborhood data and play around with the polygon styling offered by CARTO Builder. This styling will be temporary, though. We're soon going to classify this data.
  3. Click the Add button, choose the csa_farm_dropoffs layer, and click Add Layer. Now you've got both your neighborhoods and CSAs on the map.

    There are actually some built in options to aggregate the CSAs to well-known administrative regions such as country boundaries. You can see this option in the same area where you selected to use hexagons in the previous walkthrough. Neighborhood boundaries aren't built into CARTO in this way, however, so we'll have to load our own.
  4. Click the name of the neighborhood_boundaries layer to display its styling properties. Then click Analysis > Add Analysis.
  5. Choose Intersect Second Layer and click Add Analysis.
  6. Set the Intersect layer to your csa_farm_dropoffs layer and click Apply.
    Setting the intersect layer in CARTO Builder
    Figure 6.4: Setting the intersect layer in CARTO Builder
    This adds a field called count_vals to your neighborhoods layer. This field contains the number of CSA dropoff locations counted in each neighborhood. Now you'll style your polygons based on this new value.
  7. Click Style and click the Fill color to bring up the styling options.
  8. Click By Value, then scroll down and click the count_vals field.
    Styling a layer based on the count_vals field
    Figure 6.5: Styling a layer on the count_cals field
  9. Choose a color ramp and classification scheme as you did with the hexbins.

    One major disadvantage of the software at this time is that there is not an intuitive way to display the class boundaries; therefore we cannot get an informative legend about which values are encompassed in each class. This is a hindrance to critically reading and interpreting the map. If you figure out a way to do it, please share.
  10. Click Legend and change the title from count_val to something more intuitive like Number of CSA dropoff points.

    Now let's design some nice pop-up boxes that people can use to get more information on a neighborhood through a mouse click or tap.
  11. Click Pop-Up and choose the Light or Dark popup style.
  12. In the pop-up options, scroll down and check the boxes to show the name and count_vals fields, in that order. You can drag and drop to re-order the fields in your pop-ups. See the image below if you need help.
  13. Label the name and count_vals fields with some intuitive names as shown below, such as Neighborhood and Number of dropoff locations, respectively.
    Pop-up styling options in CARTO Builder
    Figure 6.6: Pop-up styling options in CARTO Builder
  14. Rename the neighborhood_boundaries layer to something nicer, like Portland neighborhoods.
    Renaming a layer in CARTO Builder
    Figure 6.7: Renaming a layer in CARTO Builder
  15. Remove the CSA layer from the map if desired. You don't really need it any more to tell the story about where CSAs are distributed.
  16. When you're really happy with your map, go back to the layer list view and click the Share button.
  17. Click Publish.
  18. Copy the hyperlink in the Get the link box and test it out in a fresh web browser. Test the pop-ups too. If something doesn't work at first, wait 5 - 10 minutes and try again.

    You can share this in e-mails, social media, etc. to allow others to explore your web map. If you make changes to your map, just click Share followed by Update and it will update the map seen by your users on the web.