uscensusbureau / citysdk

Convenient JavaScript utilities for working with Census APIs: Statistics, Cartographic GeoJSON, lat/lng -> FIPS, and other niceties (written in ClojureScript)
https://uscensusbureau.github.io/citysdk
MIT License
969 stars 183 forks source link

Cannot use FIPS codes in geoHierarchy? #343

Closed rybesh closed 4 years ago

rybesh commented 4 years ago

I would expect the following query to return all counties in North Carolina:

{
  vintage: 2018,
  geoHierarchy: {
    state: '37',
    county: '*',
  },
  geoResolution: '20m'
}

Instead, it seems to return all counties, period. Why?

loganpowell commented 4 years ago

In order to scope a citysdk geojson response down to something other than how it is stored, you will have to provide a statistics argument, that - upon merge with the geojson - will scope your request. I.e., Counties are stored at the national level. In order to get back just one state, try something like this:

{ vintage: 2018,

sourcePath: ["acs", "acs1"], geoHierarchy: { state: '37', county: '*', },

values: ["NAME"], geoResolution: '20m' }

You can read more in the README: https://github.com/uscensusbureau/citysdk#notable-example

On Thu, Apr 16, 2020 at 3:06 PM Ryan Shaw notifications@github.com wrote:

I would expect the following query to return all counties in North Carolina:

{ vintage: 2018, geoHierarchy: { state: '37', county: '*', }, geoResolution: '20m' }

Instead, it seems to return all counties, period. Why?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uscensusbureau/citysdk/issues/343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2ACP7545Y5HHCCPY5Y4YLRM5JJPANCNFSM4MKBEZVQ .

rybesh commented 4 years ago

OK, I see that I didn't read this part carefully enough:

It's important to note that - when querying for these GeoJSON files - you may retrieve a larger area than your request argument specifies. The reason for this is that the files are (currently) stored at two geographic levels: National and by State.

Thanks!