datamade / census

A Python wrapper for the US Census API.
BSD 3-Clause "New" or "Revised" License
632 stars 137 forks source link

support for state_place_tract, state_place_blockgroup, and state_place_block #28

Open fgregg opened 8 years ago

fgregg commented 8 years ago

I have extended the census class to implement methods for getting data on the the tracts, blockgroups, and blocks that intersect with a census incorporated place.

https://github.com/datamade/census_area/blob/master/census_area/__init__.py

This use's the census's tiger web rest APIs to get the geometry of a place and then find the tracts, blocks groups, or blocks within the place. Because their API limits the complexity of target geometry to use for the intersection, I also use shapely to calculate intersections locally.

Is this functionality that you would like in this library. Shapely is, unfortunately, a kind of big dependency.

ghost commented 7 years ago

@fgregg I don't mean to steel any thunder here, but we might have something for you over at @uscensusbureau. The citysdk is a beta/prototype which includes these features. We use terraformer for the cross/nesting boundary functions yo seem to be looking for...

fgregg commented 7 years ago

Thanks, @logantpowell, but I want a python solution.

fgregg commented 7 years ago

yes, but that's a javascript solution.

On Mon, Oct 24, 2016 at 6:35 AM Logan notifications@github.com wrote:

@fgregg https://github.com/fgregg I don't mean to steel any thunder here, but we might have something for you over at @uscensusbureau https://github.com/uscensusbureau. The citysdk https://github.com/uscensusbureau/citysdk/blob/master/src/api/README.md is a beta/prototype which includes these features. We use terraformer http://terraformer.io for the cross/nesting boundary functions yo seem to be looking for...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sunlightlabs/census/issues/28#issuecomment-255716462, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgxbRuUaCDu3_h7rFb_2F_5wf6EyNPoks5q3JffgaJpZM4Kd568 .

jcarbaugh commented 7 years ago

@fgregg @logantpowell just noticed this issue, but I won't have time to dig into it until this weekend.

I just got word that a more reliable project maintainer might be taking over, hopefully more responsive than I am!

ghost commented 7 years ago

@jcarbaugh Great to hear and from you! @fgregg, We now have a Node API, which allows you to use the CitySDK from any language

fgregg commented 7 years ago

@jcarbaugh that other project maintainer might be me (I told labslove@sunlightfoundation.com that DataMade would be willing to adopt this project).

In any case, I would still like your opinion on whether the heavier dependencies contemplated in this issue make sense for this project.

jcarbaugh commented 7 years ago

@fgregg I was just put in touch with a contact at Commerce, but I'm not sure when transition will officially occur.

Shapely itself doesn't seem to be that big of a deal or add any additional dependencies, other than requiring GEOS to actually do stuff. I'd be hesitant to have GEOS be a requirement in general for running the project, but think it could make sense as a contrib-style submodule. census could still have shapely as a requirement, but move the use of shapely into a defined module. Accessing methods of that module could throw an error if GEOS isn't installed.

What do you think?

fgregg commented 7 years ago

I like the idea of an optional features:

http://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies

let me put together a PR, and you can see what you think.