Search code examples
githubmarkdowngeojsongithub-flavored-markdown

How can I embed GeoJSON in markdown on GitHub?


Their toy example at docs.github.com is broken:

{
  "type": "Polygon",
  "coordinates": [
      [
          [-90,30],
          [-90,35],
          [-90,35],
          [-85,35],
          [-85,30]
      ]
  ]
}

It doesn't render as promised, and it doesn't even pass a linter.

I've created a smallish reprex to show that fixing the linter issues doesn't make it work. GitHub then complains "We can't render a map with an empty unknown collection." Fixing that doesn't seem to help either. But maybe I'm making a mistake.

What am I doing wrong?


Solution

  • Solved:

    {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "id": 1,
          "properties": {
            "ID": 0
          },
          "geometry": {
            "type": "Polygon",
            "coordinates": [
              [
                  [-90,35],
                  [-90,30],
                  [-85,30],
                  [-85,35],
                  [-90,35]
              ]
            ]
          }
        }
      ]
    }