data-science

Data science, data analysis, and machine learning in Clojure https://scicloj.github.io/pages/chat_streams/ for additional discussions
practicalli-john 2020-05-01T09:48:25.180700Z

I am using Oz library to create vega-lite views and have created several different types of visuzlizations. However, I am finding it difficult to find GeoJSON files to work with Oz. Out of 5 GeoJSON files I have tried, only one displays a map and unfortunately is broken down into regions that are very different from my data source. Is there any advice on how to debug / troubleshoot GeoJSON files either with Oz or Vega-lite? Thank you

2020-05-02T18:07:02.183900Z

No, geojson is the ticket. The problem is that sometimes you'll find geojson files that are shaped differently, so you end up having to specify a few extra things in how the json is being interpetted

2020-05-02T18:07:20.184100Z

Like, sometimes the assumptions about the shapes being loaded in matches up perfectly, as in the examples on the vega-lite examples page.

practicalli-john 2020-05-02T22:53:08.184300Z

Do you have any suggestions as to why the following draws a blue circle in Oz or in the vega-lite editor. This is the closest GeoJSON to my data set districts (its quite big so hammers the browser a bit)

{
  "$schema": "<https://vega.github.io/schema/vega-lite/v4.json>",

  "data": {
    "url": "<https://opendata.arcgis.com/datasets/6638c31a8e9842f98a037748f72258ed_0.geojson>",
    "format": {
      "type": "json",
      "property": "features"
    }
  },
 
  "mark": "geoshape"

}
Its not the end of the world if I dont get this working...

2020-05-05T18:09:30.186Z

I remember having to do this in a project in the past, but am not sure where now; basically though if you compare the shape of your json file (with jq or something similar) to the geojson file used in one of the vega-lite/vega example visualizations, you may see that it has some obviously different shape. Like, the actual geojson part of the data might be nested under some parent entity in a different way. So just as with data where the attributes you want to specify are nested, you have a to modify your field specifications to match.

practicalli-john 2020-05-05T20:34:20.187700Z

Thanks, that makes sense. I will calve out some time to experiment.

2020-05-01T10:16:02.181100Z

Sometimes the files come in somewhat different shapes so it sort of depends.

practicalli-john 2020-05-01T12:25:48.181300Z

I am using the Vega-lite web based editor to check, seems the most direct approach. I am putting my results in this Gist, along with the code used in the editor https://gist.github.com/jr0cket/96e3656ecf16be4c6bacfa566a37afc8

practicalli-john 2020-05-01T12:27:47.181500Z

@metasoarous I am not tied to GeoJSON. If there are other formats for geographical maps that work with Oz / vega-lite I would be happy to switch