formatting of BoundingBox coordinates (mapows.c)
Frank Warmerdam
warmerdam at POBOX.COM
Fri Nov 4 09:50:59 EST 2005
On 11/4/05, Martin Kofahl <martin.kofahl at uni-rostock.de> wrote:
> Hi,
> I have had some troubles with a WMS client connection mapserv last time.
> Reason was the formatting of the <BoundingBox SRS=> tag in the
> capabilities document - numbers were written as 1.11111e+06. As I
> changed to floating (see below), the application worked.
>
> Question: is there a special reason for formatting the BoundingBox as
> exponents? Could you change it?
>
>
> Changes I made in mapows.c:
>
> 1206c1206
> < msIO_fprintf(stream, "%s<%s minx=\"%f\" miny=\"%f\" maxx=\"%f\"
> maxy=\"%f\" />\n",
> ---
> > msIO_fprintf(stream, "%s<%s minx=\"%g\" miny=\"%g\" maxx=\"%g\"
> maxy=\"%g\" />\n",
> 1231c1231
> < "%s minx=\"%f\" miny=\"%f\" maxx=\"%f\"
> maxy=\"%f\"",
> ---
> > "%s minx=\"%g\" miny=\"%g\" maxx=\"%g\"
> maxy=\"%g\"",
Martin,
The downside to using %f is that we really need to provide explicit
precision (ie. %.3f or %.15f). Without knowing too much about the
SRSes in question it is often hard to pick an optimal precision. If
we pick to much precision we end up introducing "noise" digits at
the end beyond the double precision of the inputs that makes
comparison of extents with other servers messy. If we provide too
little precision and the coordinate system ends up being geographic
then we could easily be giving very poor bounds.
However, my experience is that exponential values in XML do cause
problems for some processors and so we ought to avoid it.
We do need to put some thought into how we control the precision
though.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the mapserver-dev
mailing list