@Test public void setCRSWkt() { Function f = ff.function( "setCRS", ff.literal(g), ff.literal(DefaultGeographicCRS.WGS84.toWKT())); Geometry sg = (Geometry) f.evaluate(null); assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, sg.getUserData())); }
public Object evaluate(Object feature) { Geometry geom; CoordinateReferenceSystem crs; try { geom = (Geometry) getExpression(0).evaluate(feature, Geometry.class); } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type Geometry for argument #0"); } try { crs = getExpression(1).evaluate(feature, CoordinateReferenceSystem.class); if (crs == null) { String srs = getExpression(1).evaluate(feature, String.class); try { crs = CRS.decode(srs); } catch (FactoryException e) { crs = CRS.parseWKT(srs); } } } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type CoordinateReferenceSystem, WKT or valid EPSG code for argument #1"); } if (geom != null) { geom.setUserData(crs); } return geom; }
FilterFunction_setCRS extends FunctionExpressionImpl { public Object evaluate(Object feature) { Geometry geom; CoordinateReferenceSystem crs; try { geom = (Geometry) getExpression(0).evaluate(feature, Geometry.class); } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type Geometry for argument #0"); } try { crs = getExpression(1).evaluate(feature, CoordinateReferenceSystem.class); if (crs == null) { String srs = getExpression(1).evaluate(feature, String.class); try { crs = CRS.decode(srs); } catch (FactoryException e) { crs = CRS.parseWKT(srs); } } } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type CoordinateReferenceSystem, WKT or valid EPSG code for argument #1"); } if (geom != null) { geom.setUserData(crs); } return geom; } }
FilterFunction_setCRS extends FunctionExpressionImpl { public Object evaluate(Object feature) { Geometry geom; CoordinateReferenceSystem crs; try { geom = (Geometry) getExpression(0).evaluate(feature, Geometry.class); } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type Geometry for argument #0"); } try { crs = getExpression(1).evaluate(feature, CoordinateReferenceSystem.class); if (crs == null) { String srs = getExpression(1).evaluate(feature, String.class); try { crs = CRS.decode(srs); } catch (FactoryException e) { crs = CRS.parseWKT(srs); } } } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type CoordinateReferenceSystem, WKT or valid EPSG code for argument #1"); } if (geom != null) { geom.setUserData(crs); } return geom; } FilterFunction_setCRS(); }
FilterFunction_setCRS extends FunctionExpressionImpl { public Object evaluate(Object feature) { Geometry geom; CoordinateReferenceSystem crs; try { geom = (Geometry) getExpression(0).evaluate(feature, Geometry.class); } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type Geometry for argument #0"); } try { crs = getExpression(1).evaluate(feature, CoordinateReferenceSystem.class); if (crs == null) { String srs = getExpression(1).evaluate(feature, String.class); try { crs = CRS.decode(srs); } catch (FactoryException e) { crs = CRS.parseWKT(srs); } } } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type CoordinateReferenceSystem, WKT or valid EPSG code for argument #1"); } if (geom != null) { geom.setUserData(crs); } return geom; } FilterFunction_setCRS(); Object evaluate(Object feature); }
FilterFunction_setCRS extends FunctionExpressionImpl { public Object evaluate(Object feature) { Geometry geom; CoordinateReferenceSystem crs; try { geom = (Geometry) getExpression(0).evaluate(feature, Geometry.class); } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type Geometry for argument #0"); } try { crs = getExpression(1).evaluate(feature, CoordinateReferenceSystem.class); if (crs == null) { String srs = getExpression(1).evaluate(feature, String.class); try { crs = CRS.decode(srs); } catch (FactoryException e) { crs = CRS.parseWKT(srs); } } } catch (Exception e) { throw new IllegalArgumentException( "Expected argument of type CoordinateReferenceSystem, WKT or valid EPSG code for argument #1"); } if (geom != null) { geom.setUserData(crs); } return geom; } FilterFunction_setCRS(); Object evaluate(Object feature); static FunctionName NAME; }