In Chapter 3, Introduction to Geospatial Databases, you learned how to install PostGIS, create a table, add data, and perform basic spatial queries. In this chapter, you will learn how to work with geospatial databases to answer questions and make maps. This chapter will have you load crime data into tables. Once you have populated your geodatabase with real-world data, you will learn how to perform common crime analysis tasks. You will learn how to map queries, query by date ranges, and perform basic geoprocessing tasks such as buffers, point in polygon, and nearest neighbor. You will learn how to add widgets to your Jupyter Notebooks to allow queries to be interactive. Lastly, you will learn how to use Python to create charts from your geospatial queries. As a crime analyst, you will make maps, but not all GIS-related tasks are map-based. Analysts use GIS data to answer questions and create reports. Executives are often more familiar with charts...
You're reading from Mastering Geospatial Analysis with Python
To build an interactive crime dashboard, you will need to collect data to build a database. Then, you will query the data and add widgets to allow users to modify the queries without needing to code. Lastly, you will graph and map the query results.
To build the components for a crime dashboard, we will use the City of Albuquerque's open data. Albuquerque has datasets for crime incidents, as well as area commands and beats
. By combining the areas with incidents
, you will be able to report on two geographic areas. You could then extend the analysis using neighborhood associations or any other boundary—Census blocks, groups, or tracts, and get demographic information as well.
Note
You can find links to the data on the main open data site located at: http://www.cabq.gov/abq-data/. Scroll to the bottom of the page and look for the Safety Data Sets
heading.
In this chapter, you learned how to use spatial queries to perform geoprocessing tasks. You also learned how to map and chart the results of your queries using ipyleaflet
and data frames. You learned how to modify the maps and queries using interactive widgets in Jupyter. Lastly, you learned about how triggers work, and were shown a quick example of data checking using trigger.
In the next chapter, you will learn how to perform geoprocessing tasks using QGIS. You will learn how to use toolboxes that are already included in QGIS. You will learn how to write your own toolboxes that you can use and share with other QGIS users, and you will learn how to use QGIS to map the results. The results can be saved as a QGIS project, or as one of many spatial data formats from QGIS.