Hello,
When uploading an “empty” Shapefile (i.e. with no features), it looks like GeoServer configures the datastore with bounds being equal to what is explicitly specified in the Shapefile.
And clicking on “compute from data” in the configuration page doesn’t make the value change.
So what bounds should be advertised for layers of this kind? All zeros? That’s what OGR does apparently:
$ ogrinfo -al empty.shp
Layer name: empty
Geometry: Line String
Feature Count: 0
Extent: (19496742305194890055511892394450289164288.000000, 19496742305194890055511892394450289164288.000000) - (-19496742305194890055511892394450289164288.000000, -19496742305194890055511892394450289164288.000000)
Layer SRS WKT:
GEOGCS[“GCS_WGS_84”,
DATUM[“WGS_84”,
SPHEROID[“WGS84”,6378137,000,298,257223563]],
PRIMEM[“Greenwich”,0.0],
UNIT[“Degree”,0.0174532925199433]]
ID: String (10.0)
…
$ ogrinfo -sql ‘RECOMPUTE EXTENT ON empty’ empty.shp
$ ogrinfo -al empty.shp
Layer name: empty
Geometry: Line String
Feature Count: 0
Extent: (0.000000, 0.000000) - (0.000000, 0.000000)
Layer SRS WKT:
GEOGCS[“GCS_WGS_84”,
DATUM[“WGS_84”,
SPHEROID[“WGS84”,6378137,000,298,257223563]],
PRIMEM[“Greenwich”,0.0],
UNIT[“Degree”,0.0174532925199433]]
ID: String (10.0)
…
I know it doesn’t make much sense to work with empty Shapefiles but I have to handle this case, having a user-exposed GeoServer.
More precisely, I have an application which queries GeoServer for layers information and then feeds it to OpenLayers for WMS rendering.
And I can confirm that OpenLayers really chokes on extent values like the weird one shown above
Thanks for your help!
–
Damiano Albani