1

My app returns standard GeoJSON, always as a FeatureCollection.

When I display the GeoJSON in my front end, I want to zoom to show just the features in the file. I'd like to include an enclosing boundary box to make that easier:

{
    "boundaries": [12.3456, 78.9012, 34.5678, 90.1234],
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "properties": {
            "name": "value"
        },
        "geometry": {
            "type": "Point",
            "coordinates": [...]
        }
    }]
}

Is it acceptable to non-standard fields like this? Is this valid GeoJSON or will third-party tools choke on it?

1
  • And yes, you can add non-standard fields (aka "foreign members") but support will vary. Some software may ignore it, some may fail to parse the geojson.
    – user2856
    Mar 10, 2021 at 22:04

1 Answer 1

3

The standard already allows you to add a bbox inside the feature collection.

A GeoJSON object MAY have a member named "bbox" to include information on the coordinate range for its Geometries, Features, or FeatureCollections.

2
  • 2
    The standard is this tools.ietf.org/html/rfc7946#section-5 A GeoJSON object MAY have a member named "bbox" to include information on the coordinate range for its Geometries, Features, or FeatureCollections.
    – user30184
    Mar 10, 2021 at 18:40
  • thanks, I was on my phone so adding the link was too hard
    – Ian Turton
    Mar 11, 2021 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.