Discussion:
[gdal-dev] Removing trailing decimals from contour labels of shape files
Jason Snyder via gdal-dev
2021-05-15 00:28:23 UTC
Permalink
I tried making shape files of pressure from netcdf files using the
following commands using gdal:

gdal_contour -a pressure -i 4 -off 0 pressure.nc pressure.shp

I noticed that when displaying the graph in mapserver I get label values
such as 1010.00000000 whereas I want the labels to be whole numbers. How do
I tweak this code to get whole numbers for pressure contour labels in map
server?

I have noticed that in the netcdf file pressure.nc that the pressure values
have three trailing decimal points after them so a pressure value in the
netcdf file will be 1010.000 instead of 1010. I also noticed that viewing
the dbf file. Do I need to fix the netcdf file to display intergers? If so
how do I do this?

Thank you for your time.

Jason Snyder
--
Jason Snyder PhD
Mike Taves
2021-05-15 10:55:26 UTC
Permalink
On Sat, 15 May 2021 at 12:28, Jason Snyder via gdal-dev
I noticed that when displaying the graph in mapserver I get label values such as 1010.00000000 whereas I want the labels to be whole numbers. How do I tweak this code to get whole numbers for pressure contour labels in map server?
Try adding -lco RESIZE=YES to the command to resize fields to their optimal size

https://gdal.org/drivers/vector/shapefile.html#layer-creation-options
jratike80
2021-05-15 16:50:28 UTC
Permalink
Hi,

You may ask help from mapserver-users for the Mapserver side. It is possible
to format the labels by expressions. See the example in
https://mapserver.org/mapfile/class.html#class

"More advanced Expressions can be used to specify the labels. Since version
6.0, there are functions available for formatting numbers:

TEXT ("Area is: " + tostring([area],"%.2f"))"

-Jukka Rahkonen-
Post by Jason Snyder via gdal-dev
I tried making shape files of pressure from netcdf files using the
gdal_contour -a pressure -i 4 -off 0 pressure.nc pressure.shp
I noticed that when displaying the graph in mapserver I get label values
such as 1010.00000000 whereas I want the labels to be whole numbers. How do
I tweak this code to get whole numbers for pressure contour labels in map
server?
I have noticed that in the netcdf file pressure.nc that the pressure values
have three trailing decimal points after them so a pressure value in the
netcdf file will be 1010.000 instead of 1010. I also noticed that viewing
the dbf file. Do I need to fix the netcdf file to display intergers? If so
how do I do this?
Thank you for your time.
Jason Snyder
--
Jason Snyder PhD
_______________________________________________
gdal-dev mailing list
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
Loading...