Esri / cedar

JavaScript Charts for ArcGIS
https://esri.github.io/cedar
257 stars 238 forks source link

Support for fetching non-esri JSON #438

Open khibma opened 6 years ago

khibma commented 6 years ago

The doc says you can point at JSON files, but do these static files still need to conform to a feature service like response?

Per: https://esri.github.io/cedar/examples/inlined-data.html It states the expected input needs to look like...

{
  ...other properties...
  features:[
    {
      "attributes": {
        "ZIP_CODE": 20005,
        "TOTAL_STUD_SUM": 327
      }

I was hoping to point a chart at an API, like https://city-of-ottawa-dev.apigee.net/open311/v2/requests.json inside the ArcGIS Hub. Everything inside this particular JSON request starts immediately as items inside a list. No features, no attributes keys.

benstoltz commented 6 years ago

Hi there @khibma, currently we don't have any way to pull in an external api (non esri based) like that. But we are now adding that feature to the backlog. As an alternative you can also inline data. It would look something like:

{
  "datasets": {
    "data": [{}, {}, etc]
  }
}

I know it's not the greatest work around, but it could potentially help in this case. As an aside inlined data can take the following formats:

Hope this helps and we'll keep you apprised in terms of pulling in non-esri apis.

khibma commented 6 years ago

thanks @benstoltz - I appreciate and will investigate this. This answers my question, feel free to close this if you need for your issue management.

tomwayson commented 6 years ago

Thanks @khibma - I'm going to leave this issue open as a feature request to support fetching non-esri data sources in addition to being able to inline them as @benstoltz suggests above.