formatting numbers

Stephen Lime steve.lime at dnr.state.mn.us
Tue Jan 16 11:20:07 EST 2001


MapServer internally treats everything as a string so that's what's coming from
the xbase code. May be dependent on the number of decimals allowed for that
attribute. One way would be to filter the MapServer output through JavaScript,
for example in your template:

<script language="javascript">
  var nfarms = [nfarms];

  ... code to format the value of nfarms ...
  document.write("Number of Farms (1987): " + nfarms);
</script>

Or something similar. Let me think about it a bit more. It's likely that a modification
to DBFReadAttribute() in mapxbase.c specific to floating point columns would have
to be made.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Andrea Goethals <andreag at geoplan.ufl.edu> 01/12/01 01:54PM >>>
I haven't seen any questions about this:

Is there a way with Mapserver to change the format of the numbers
brought back from a query on an attribute?

All my numbers get displayed in scientific notation like:

Number of Farms (1987): 2.200000E+02
Acres of Land in Farms (1987): 2.793700E+04
Percent of County as Land in Farms (1987): 7.399501E+00
Acres of Land in Farms (1982): 3.215600E+04

Thanks,
Andrea


-- 
@-------------------------@
| Andrea Goethals         |
| andreag at geoplan.ufl.edu |
| GeoPlan Center          |
| University of Florida   |
@-------------------------@




More information about the mapserver-users mailing list