Skip to content

Commit

Permalink
Fix the grid unit symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Aug 30, 2024
1 parent c80f7c1 commit c7f27b4
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,6 +15,8 @@
import java.util.Arrays;
import java.util.IllegalFormatException;

import javax.measure.Unit;

/**
* Parameters relevant to creating Grid layers.
*/
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit c7f27b4

Please sign in to comment.