Skip to content

Instantly share code, notes, and snippets.

@adamsteer
Created October 5, 2019 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamsteer/d6b50853661e1cde32500d5d7b1f7e0a to your computer and use it in GitHub Desktop.
Save adamsteer/d6b50853661e1cde32500d5d7b1f7e0a to your computer and use it in GitHub Desktop.
the GeoJSON I want to see...
{
"type": "GeometryCollection",
"geometries": [
{
"type": "Polygon",
"coordinates": [
[
[
251796.55712,
5746131.5569
],
[
252046.54222,
5746131.5569
],
[
252046.54222,
5746381.541999999
],
[
251796.55712,
5746381.541999999
],
[
251796.55712,
5746131.5569
]
]
],
"properties": {
"qc_score": -1,
"blur_score": 66.33602489549324
}
}],
],
"properties": {
"image": "../sample-data/image.tif",
"date": "04:10:2019T23:43:05"
}
}
@rowanwins
Copy link

Hey @adamsteer

It needs to be something like

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {
                "qc_score": -1,
                "blur_score": 66.33602489549324
            },
            "geometry": {
                "type": "Polygon",
                "coordinates": [
                    [
                        [
                            251796.55712,
                            5746131.5569
                        ],
                        [
                            252046.54222,
                            5746131.5569
                        ],
                        [
                            252046.54222,
                            5746381.541999999
                        ],
                        [
                            251796.55712,
                            5746381.541999999
                        ],
                        [
                            251796.55712,
                            5746131.5569
                        ]
                    ]
                ]
            }
        }
    ]
}

This bit however is problematic

    "properties": {
        "image": "../sample-data/image.tif",
        "date": "04:10:2019T23:43:05"
    }

You could try and put it on the FeatureCollection however it won't get picked up by something like QGIS. If you want it to get picked up by QGIS you need to add to the Feature properties object.

@adamsteer
Copy link
Author

Thanks @rowanwins - I’ve switched to FeatureCollection - and the collection level properties block doesn’t appear to cause issues in QGIS.

Collection level properties would be nice - to avoid saying the same thing over. As an example, in rasters and point clouds we state the metadata at the ‘collection of pixels’ or ‘collection of points’ level, since it’s kind of insane to create a bunch of duplicate data.

@rowanwins
Copy link

Yeah unfortunately it's a spec thing, GeoJSON is a very bare-bones spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment