Skip to content

Instantly share code, notes, and snippets.

@ceteri
Created May 31, 2020 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ceteri/7b0294d2f87405363a05a2f9924501c9 to your computer and use it in GitHub Desktop.
Save ceteri/7b0294d2f87405363a05a2f9924501c9 to your computer and use it in GitHub Desktop.
Geo 2
wget https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_state_20m.zip
mkdir maps
cd maps
unzip ../cb_2018_us_state_20m.zip
@elhamdaha
Copy link

Hi- How can I get via python?

@ceteri
Copy link
Author

ceteri commented Jul 21, 2021

Here's an equivalent in Python:

import io
import requests 
import zipfile

url = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_state_20m.zip"

r = requests.get(url, stream=True)
z = zipfile.ZipFile(io.BytesIO(r.content))
z.extractall("maps")

@elhamdaha
Copy link

Thank you for your response!

@elhamdaha
Copy link

What if I don't save the zip code? I want to call the geo and then after preparing some queries, save a new database which includes geometry (longitude/latitude).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment