3

Just started using Geoserver 2.5.2. On my old server which was Geoserver 2.1 when you ran a WFS request to return GeoJSON (or, for a quick example, clicked Layer Preview -> All Formats -> GeoJSON) the returned JSON contained a bbox property giving the bounding box for the returned results. I've written some applications that rely on this value being present but now they are all failing because the GeoJSON being returned does not conatain the bbox property.

e.g. old:

{
"type":"FeatureCollection",
"features": [..features here...],
"crs":{"type":"EPSG",
    "properties":{"code":"4326"}
      },
    "bbox":[0,52,0,52]

}

New:

{
"type":"FeatureCollection",
"features": [..features here...],
"crs":{"type":"EPSG",
    "properties":{"code":"4326"}
      }

}

Is there an option I need to enable to encourage it to return this property or has the GeoJSON spec changed since GeoServer 2.1 to exclude it? That would be very inconvenient! Can I get it back?

4
  • 1
    I don't think bbox has ever been mandatory in GeoJSON but it is unhappy that your application is broken now. I checked with GeoServer 2.6 that GML contains an empty bbox by default but that can be added from WFS service settings "Return bounding box with every feature". That seems to generate bbox for the whole connection too. Unfortunately GeoJSON remains just the same. I suggest to write to geoserver-users mailing list and if issue is confirmed to make a feature request.
    – user30184
    Commented Nov 27, 2014 at 17:19
  • Ticking that box seems to add a bbox object to every feature, rather than the feature collection (in 2.5.1 at least). It shouldn't be too difficult to update your application to loop through all of those bbox responses to come up with the same result.
    – Guy
    Commented Nov 27, 2014 at 17:27
  • As I wrote, in 2.6 with this setting bbox is generated for each feature and a global one for the whole collection.
    – user30184
    Commented Nov 27, 2014 at 17:35
  • If only you'd tested 2.6beta or 2.6rc1 or rc2 we would have had a chance to fix it.
    – Ian Turton
    Commented Nov 27, 2014 at 17:40

1 Answer 1

5

GeoServer has the option to "Return bounding box with every feature" under Services » Web Feature Service (WFS) » WFS settings.

According to GeoServer documentation:

Return bounding box with every feature — When creating the GetFeature GML output, adds an auto-calculated bounds element on each feature type. Not typically enabled, as including bounding box takes up extra bandwidth.

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.