Skip to content

Conversation

@TheCedarPrince
Copy link

Hey @asinghvi17,

Finally, after a year in the making (more like 3 hours), we have downloading somewhat built out as a first draft for TigerLine.jl! This adds a few useful constants and one new function called download_tiger. Here is what it covers:

julia> using TigerLine

julia> ?TIGER_DICT

    •  "county" (COUNTY) - County
    •  "state" (STATE) - State and Equivalent

julia> download_tiger("DIRECTORY_OF_CHOICE", year=2020, layer="county")

Not sure how to add tests to this, but otherwise, excited to get this functionality made finally!

"""
Base URL for TIGER/Line data with two parameters for year and layer.
"""
BASE_TIGER_URL = FormatExpr("https://www2.census.gov/geo/tiger/TIGER{}/{}/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be const

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But maybe it could be a function?

base_tiger_url(year, layer) = "https://www2.census.gov/geo/tiger/TIGER$(year)/$(layer)/"

which would neatly remove the Format.jl dependency as well.

for f in files
@info "Downloading $f for layer, \"$(TIGER_DICT[layer])\", and year, $year."
download(
joinpath(url, f),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely be incorrect on windows (backslash)


## Keys

- `"address_range_rel"` (**ADDR**) - Address Range Relationship File
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the three different things here? julia name, tiger name, description? We should describe this explicitly

# "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_state_5m.zip"

"""
A dictionary mapping human-readable keys to TIGER/Line dataset codes and their associated descriptions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not quite true as of now? There seem to be no descriptions

)
```
Downloads TIGER/Line geographic data from the US Census Bureau for the specified year and geographic layer,
saving the data as shapefiles.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not quite - seems it saves as zip files? Shapefile.jl has zip support via ZipFile.jl but it's a bit dicey.

@asinghvi17
Copy link
Member

I made a new PR #7 with this code and some additions from my end, but can't target it to this branch.

@asinghvi17
Copy link
Member

See TheCedarPrince#1 for the diff if interested, feel free to merge that there as well and I can close #7 here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants