Hi Guys,
Been working my way through the tutorials and some other reading material suggested by other members, and am very happy I stuck it out with observable. Things are starting to click! I have to say reading the article on ES modules has pulled the curtain back on a whole other world. Seeing how compartmentalized the script is using observable and modules in general really makes the scripts much easier to understand.
Iāve been working through some of the visualizations and I came across this census based visualization by Logan Williams and created my own fork to tinker with it a bit. The script presentlly provides a visualization of all counties in the US based on any variable provided by the US census based on user inputs and works very well. Hereās the code: Census Data Request. I āthinkā Iām using the āforkā functionality of Observable correctly? Now you guys can go right to my code to review it and make any changes you see fit, correct? (or do I need to publish the forked version first?)
Presently, the notebook above only provides a visualization of all counties in the US and the user requested stats. (I say āonly providesā but itās actually very impressive how a few lines of code could create something so versatile and rich with data!)
Iād like to expand the functionality to allow the user to select the specific area (and resulting map displayed) based on their input. Based on what Iāve read so far from the ES6 modules, I believe Iāll need to run multiple module āinstancesā to provide the specific āviewā Iām looking for.
First, Iād like to allow the user to search any area in the US (and preferably Canada as well) by any of the following criteria:
- Country
- State (or Province in CAN)
- City or County
- Zip
- Neighborhood
Iām guess the first thing I need to do is determine if there are any modules that can allow people to search by the above criteria. From what Iāve read about the Census API, it searches based on FIPS codes (if memory serves me correctly). Iām guessing that means the first module instance should look at the search criteria provided - Country, Country/State, Country/State/City, Country/Zip, or Country/State/(maybe city?)/Neighborhood, and decide how to select the appropriate map and draw it. Is there a topojson or geojson file that I could reference that would provide the parameters Iām looking for?
Once the map has been drawn, I think the rest of the code should be almost identical to what Logan put together in his notebook (againā¦very impressive Logan!). This would be the 2nd module instance that would be returned by the program. By default, the map would be populated with some default data, like say maybe the population growth over the last 10 years. The user would then request the variable(s) they seek - like say maybe the number of individuals over 21 - and the resulting map would be populated with the data.
Iām still trying to learn all the terminology, so please let me know if Iāve used any terms like view or instance in the wrong fashion. Thanks in advance!!