![]() Query the DataFrame for a specific state shape, I will plot Texas. More info on colormaps can be found here ot(cmap='magma', figsize=(12, 12)) Pastel1, Pastel2, PAired, Accent, Dark2, Set1, Set2, Set3, tab10, tab20, tab20b, tab20c PiYg, PRGn, BrBG, PuOr, RdGy, RdBu, RdYlBu, Spectral, coolwarm, bwr, seismic YlOrBr, OrRd, PuRd, RdPu, BuPu, GnBu, PuBu, YlGnBu, PuBuGn, BuGn, YlGn Greys, Purples, Blues, Greens, Oranges, Reds Here are some cmap codes you can play around with. Our map is bit small and only one solid color. We can also plot the state polygons with no fill color by using (). Now lets plot our GeoDataFrame and see what we get. ![]() To make the map look a little more familiar lets reproject it’s coordinates to Mercator. “EPSG:32733” UTM Zones (South) – (Universal Transverse Mercator).“EPSG:32633” UTM Zones (North) – (Universal Transverse Mercator).“EPSG:4326” WGS84 Latitude/Longitude, used in GPS. ![]() Geopandas requires we know the geospatial reference system identifier so here is a list of common ones. If you want to learn more about coordinate systems, have a look at this excellent post EPSG 4326 vs EPSG 3857 by Lyzi Diamond. While WGS 84 is very common in GIS mapping, Mercator projection is the de facto standard for Web mapping applications. Understanding Coordinate reference systems (CRS)īy default this shapefile contains very commons coordinates called WGS 84. states = geopandas.read_file('data/usa-states-census-2014.shp') Geopandas will return a GeoDataFrame object which is similar to a pandas DataFrame. Use the geopandas.read_file() function to read the shapefile from disk. Import the geopandas library and matplotlib for later use. rw-rw-r- 1 sysadmin sysadmin 564 May 1 20:37 usa-states-census-2014.shx rw-rw-r- 1 sysadmin sysadmin 257 May 1 20:37 usa-states-census-2014.qpj rw-rw-r- 1 sysadmin sysadmin 143 May 1 20:37 usa-states-census-2014.prj rw-rw-r- 1 sysadmin sysadmin 5 May 1 20:37 usa-states-census-2014.cpg ĭrwxrwxr-x 4 sysadmin sysadmin 4096 May 2 03:20. Wikipedia ls -al data total 364ĭrwxrwxr-x 2 sysadmin sysadmin 4096 May 1 20:37. It is developed and regulated by Esri as a mostly open specification for data interoperability among Esri and other GIS software products. The shapefile format is a geospatial vector data format for geographic information system (GIS) software. It contains no unique data, only an index of record offsets. filename.shx – Shapefile index, this file makes working with larger shapefiles faster.filename.dbf – Shapefile attribute format, this file stores the attributes for each shape.filename.shp – Shapefile shape format, contains the actual geometry data.A shapefile actually consists of 3 separate files with the same file name. The data we will be working with comes from the US Census and is in a common shapefile format. Here are the commands you will need to run if have not already installed geopandas. To start, clone my git repository with the following commands. I have used other GIS libraries in python and let me say geopandas is a real joy to use! Jonathan CutrerĪ quick note before we start I assume you know some basic python and how to install jupyter to run the companion notebook. You can run all of the python code examples in the tutorial by cloning the companion github repository. In this tutorial we will take a look at the powerful geopandas library and use it to plot a map of the United States.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |