Fork me on GitHub
#data-science
<
2020-05-01
>
practicalli-johnny09:05:25

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

metasoarous10:05:02

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

practicalli-johnny12:05:48

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-johnny12:05:47

@U05100J3V 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

metasoarous18:05:02

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

metasoarous18:05:20

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

practicalli-johnny22:05:08

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": "",

  "data": {
    "url": "",
    "format": {
      "type": "json",
      "property": "features"
    }
  },
 
  "mark": "geoshape"

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

metasoarous18:05:30

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-johnny20:05:20

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