Infact the first envelope is more useful than the second - as you can check
if width (or height) is negative with the first and thus infer that it is
empty while with the second it is either empty or a point in the centre of
Null Island (see https://en.wikipedia.org/wiki/Null_Island) and thus might
be empty or not depending on the number of records in the shapefile (which
as Andrea pointts out could be expensive to calculate).
I'm pretty sure GeoTools stores empty envelopes as an inside out infinite
envelope when they are empty (it certainly used to) so that you can easily
add points to the empty envelope to expand it with out having to handle any
special cases for empty or half empty envelopes.
Ian
On 21 January 2014 16:08, Damiano Albani <[email protected]> wrote:
> 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
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
--
Ian Turton
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users