{ "cells": [ { "cell_type": "markdown", "id": "53aec29b", "metadata": {}, "source": [ "# Working With Geometries\n", "\n", "\n", "\n", "In the course of working with legislative redistricting data, it is inevitable that\n", "we will have to work with files that contain geometries. Most often, these geometries\n", "come in the form of shapefiles, which, while nice in theory, can be a bit of a pain to\n", "work with in practice. For now, we will focus on the basics of working with geometries,\n", "but the interested reader is encouraged to explore our partnered library,\n", "[maup](https://github.com/mggg/maup#readme), which is specifically designed to\n", "help fix tricky geometry problems. Specifically, in the event that you are working with\n", "a shapefile and run in to an error of the flavour:\n", "\n", "```console\n", "UserWarning: Found overlaps among the given polygons.\n", "Indices of overlaps: {(887, 892), (893, 915), (892, 914), (887, 893)}\n", "```\n", "\n", "or\n", "\n", "```console\n", "UserWarning: Found islands (degree-0 nodes). Indices of islands: {2552, 3107}\n", "\"Found islands (degree-0 nodes). Indices of islands: {}\".format(islands)\n", "```\n", "\n", "then you should consider consulting the\n", "[maup documentation](https://github.com/mggg/maup/wiki/)\n", "to see if it can help you out." ] }, { "cell_type": "markdown", "id": "388c42c3", "metadata": {}, "source": [ "## Loading and Running a Plan\n", "\n", "