{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Quickstart\n", "\n", "`geoplot` is a geospatial data visualization library designed for data scientists and geospatial analysts that just want to get things done. In this tutorial we will learn the basics of `geoplot` and see how it is used.\n", "\n", "You can run this tutorial code yourself interactively using [Binder](https://mybinder.org/v2/gh/ResidentMario/geoplot/master?filepath=notebooks/tutorials/Quickstart.ipynb)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Configure matplotlib.\n", "%matplotlib inline\n", "\n", "# Unclutter the display.\n", "import pandas as pd; pd.set_option('max_columns', 6)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The starting point for geospatial analysis is geospatial data. The standard way of dealing with such data in Python using `geopandas`—a geospatial data parsing library over the well-known `pandas` library." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import geopandas as gpd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`geopandas` represents data using a `GeoDataFrame`, which is just a `pandas` `DataFrame` with a special `geometry` column containing a geometric object describing the physical nature of the record in question: a `POINT` in space, a `POLYGON` in the shape of New York, and so on." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | id | \n", "POP_2010 | \n", "ELEV_IN_FT | \n", "STATE | \n", "geometry | \n", "
---|---|---|---|---|---|
0 | \n", "53 | \n", "40888.0 | \n", "1611.0 | \n", "ND | \n", "POINT (-101.2962732 48.23250950000011) | \n", "
1 | \n", "101 | \n", "52838.0 | \n", "830.0 | \n", "ND | \n", "POINT (-97.03285469999997 47.92525680000006) | \n", "
2 | \n", "153 | \n", "15427.0 | \n", "1407.0 | \n", "ND | \n", "POINT (-98.70843569999994 46.91054380000003) | \n", "
3 | \n", "177 | \n", "105549.0 | \n", "902.0 | \n", "ND | \n", "POINT (-96.78980339999998 46.87718630000012) | \n", "
4 | \n", "192 | \n", "17787.0 | \n", "2411.0 | \n", "ND | \n", "POINT (-102.7896241999999 46.87917560000005) | \n", "