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

User Guides are Incorrect #299

Closed michael2million closed 5 years ago

michael2million commented 8 years ago

Are you guys aware that the basic User Guides don't work (examples are broken, libraries are incorrect)? https://uscensusbureau.github.io/citysdk/guides.html

Can you please update your instructions? Based on another post here, I replaced the libraries listed on your Getting Started page with these:

That got the GEORequest working, but now getting this error:

jquery.min.js:4 XMLHttpRequest cannot load file://api.census.gov/data/2014/acs5/geography.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

Is this project being maintained? If not, can you suggest a better way to get US Census Data with an API?

Thank you!

ghost commented 8 years ago

Hi @michael2million we are working on repairing the documentation, but currently we are without a developer (just after a major update to the code). Based on your request, I would recommend using the new Node Proxy for the time being... very sorry again for the inconvenience. As you might be able to tell, we are still prototyping...

michael2million commented 8 years ago

Ok, I'll try using that. I see there is a Python example - do you have any JavaScript examples you can share for making a request that returns GeoJSON with Census Data? Thanks! (Any idea on the timeline for getting the SDK functional?)

ghost commented 8 years ago

The Node Proxy functions like an API, so you just pass arguments over a GET request. Also, the JavaScript SDK does work. We have just made a major update to the code though. When did you last fork/download?

michael2million commented 8 years ago

I'll try using the Node Proxy. I got part of the SDK to work (returning GeoJSON, but not the data for each geography). I'm downloading the libraries with these script tags in my HTML:

// //

Are there more updated ones I should be using?

michael2million commented 8 years ago

Sorry, these library files: http://uscensusbureau.github.io/citysdk/static/js/citysdk/citysdk.js http://uscensusbureau.github.io/citysdk/static/js/citysdk/citysdk.census.js

ghost commented 8 years ago

You might be getting out of date stuff from the .io docs... for the time being it would be best to stick with the instructions found on the repo:

https://github.com/uscensusbureau/citysdk https://github.com/uscensusbureau/citysdk/tree/master/src/sdk/core

michael2million commented 8 years ago

I loaded those files in the browser and ran the example script:

CitySdk.request(request).then((response) => doSomethingWithData(response));

But I got the error "CitySdk is not defined."

So I looked in this file: s3.amazonaws.com/citysdk/releases/0.2.0/citysdk.js, to see what was actually defined. I tried something that was: CitySDK.prototype.jsonpRequest()

Then I got the error: XMLHttpRequest cannot load (my callback). Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

Can you provide one simple working example for a GEORequest() call?

ghost commented 8 years ago

@tshrestha Can you help us out with this sir?

michael2million commented 8 years ago

Just realized my problem was with browser security. Got it working now. But it would be nice to have at least a simple & definitive JS example - which script tags to use for loading the most updated libraries, and a working example of the APIRequest and GEORequest.

FYI, my app is working with the library files you said might be outdated (http://uscensusbureau.github.io/citysdk/static/js/citysdk/citysdk.js http://uscensusbureau.github.io/citysdk/static/js/citysdk/citysdk.census.js), but I couldn't make the examples on the repo work (maybe I'm doing them wrong, not sure).

Thanks!

tshrestha commented 8 years ago

It looks like the AWS S3 link has stopped working. I think that bucket might be out of commission. You can still download the latest release and follow the guide in the README.md.

You'll need to replace the S3 link in the <script>.