public static void setComparisonTolerance() { // need to set hint which allows for lax projection lookups to match // random wkt to an epsg code Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE, 1e-9); }
protected void setUp() throws Exception { Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, true); }
public static Geometry Transform(Geometry inGeom, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) { Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); if(sourceCRS.equals(targetCRS)) return inGeom; MathTransform transform; try { transform = CRS.findMathTransform(sourceCRS, targetCRS, true); } catch (FactoryException e) { logger.error("Cannot find a transformation!", e); return inGeom; } Geometry outGeom = null; try { outGeom = JTS.transform(inGeom, transform); } catch (MismatchedDimensionException e) { logger.error("Cannot perform the transformation!", e); return inGeom; } catch (TransformException e) { logger.error("Cannot perform the transformation!", e); return outGeom; } return outGeom; }
@BeforeClass public static void before() { Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, false); Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, true); }
Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http"); Hints.putSystemDefault(Hints.LENIENT_DATUM_SHIFT, true); Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE, comparisonTolerance); Hints.putSystemDefault(Hints.FILTER_FACTORY, CommonFactoryFinder .getFilterFactory2(null)); Hints.putSystemDefault(Hints.STYLE_FACTORY, CommonFactoryFinder .getStyleFactory(null)); Hints.putSystemDefault(Hints.FEATURE_FACTORY, CommonFactoryFinder .getFeatureFactory(null)); Hints.putSystemDefault(Hints.GRID_COVERAGE_FACTORY, CoverageFactoryFinder .getGridCoverageFactory(defHints));
public static String Transform(String inGeomWKT, String fromSRID, String toSRID) { Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
Hints.putSystemDefault(hints);
Hints.putSystemDefault(hints);