From c7f27b4ae789d4d19178cd4298947464385bd726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Tue, 1 Mar 2022 13:58:54 +0100 Subject: [PATCH] Fix the grid unit symbol --- .../mapfish/print/map/geotools/grid/GridParam.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/mapfish/print/map/geotools/grid/GridParam.java b/core/src/main/java/org/mapfish/print/map/geotools/grid/GridParam.java index 5afe04964a..a33e9638a7 100644 --- a/core/src/main/java/org/mapfish/print/map/geotools/grid/GridParam.java +++ b/core/src/main/java/org/mapfish/print/map/geotools/grid/GridParam.java @@ -1,5 +1,6 @@ package org.mapfish.print.map.geotools.grid; +import org.geotools.measure.Units; import org.geotools.referencing.CRS; import org.geotools.referencing.operation.transform.IdentityTransform; import org.locationtech.jts.util.Assert; @@ -14,6 +15,8 @@ import java.util.Arrays; import java.util.IllegalFormatException; +import javax.measure.Unit; + /** * Parameters relevant to creating Grid layers. */ @@ -244,14 +247,14 @@ public void postConstruct() { * @param mapCrs the crs of the map, used if the {@link #labelProjection} is not defined. */ public String calculateLabelUnit(final CoordinateReferenceSystem mapCrs) { - String unit; + Unit unit; if (this.labelProjection != null) { - unit = this.labelCRS.getCoordinateSystem().getAxis(0).getUnit().toString(); + unit = this.labelCRS.getCoordinateSystem().getAxis(0).getUnit(); } else { - unit = mapCrs.getCoordinateSystem().getAxis(0).getUnit().toString(); + unit = mapCrs.getCoordinateSystem().getAxis(0).getUnit(); } - return unit; + return Units.toSymbol(unit); } /**