/** * Loads from epsg.properties if the file exists, defaults to internal defintions exported from * postgis and cubeworks. */ public EPSGCRSAuthorityFactory() { this(ReferencingFactoryFinder.getCRSFactory(null)); }
/** * Returns the {@linkplain CRSFactory CRS factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CRSFactory getCRSFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCRSFactory(hints); }
/** * Returns the {@linkplain CoordinateReferenceSystem coordinate reference system} factory. * * @return The Coordinate Reference System factory. */ public CRSFactory getCRSFactory() { if (crsFactory == null) { synchronized (hints) { crsFactory = ReferencingFactoryFinder.getCRSFactory(hints()); } } return crsFactory; }
/** * Parses a <A * HREF="http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/referencing/doc-files/WKT.html"><cite>Well * Known Text</cite></A> (WKT) into a CRS object. This convenience method is a shorthand for the * following: * * <blockquote> * * <code> * FactoryFinder.{@linkplain ReferencingFactoryFinder#getCRSFactory getCRSFactory}(null).{@linkplain * org.opengis.referencing.crs.CRSFactory#createFromWKT createFromWKT}(wkt); * </code> * * </blockquote> */ public static CoordinateReferenceSystem parseWKT(final String wkt) throws FactoryException { return ReferencingFactoryFinder.getCRSFactory(null).createFromWKT(wkt); }
/** Creates a builder from the specified hints. */ public MathTransformBuilder(final Hints hints) { mtFactory = ReferencingFactoryFinder.getMathTransformFactory(hints); crsFactory = ReferencingFactoryFinder.getCRSFactory(hints); datumFactory = ReferencingFactoryFinder.getDatumFactory(hints); }
/** * Load the index file from the given channel. * * @param channel The channel to read from. * @param hints * @throws IOException If an error occurs. */ public PrjFileReader(ReadableByteChannel channel, final Hints hints) throws IOException, FactoryException { try { Charset chars = Charset.forName("ISO-8859-1"); decoder = chars.newDecoder(); this.channel = channel; init(); // ok, everything is ready... decoder.decode(buffer, charBuffer, true); buffer.limit(buffer.capacity()); charBuffer.flip(); crs = ReferencingFactoryFinder.getCRSFactory(hints) .createFromWKT(charBuffer.toString()); } finally { // we are done reading, so just close this close(); } }
/** * Constructs a parser for the specified set of symbols using default factories. * * @param symbols The symbols for parsing and formatting numbers. * @todo Pass hints in argument. */ public Parser(final Symbols symbols) { this( symbols, ReferencingFactoryFinder.getDatumFactory(null), ReferencingFactoryFinder.getCSFactory(null), ReferencingFactoryFinder.getCRSFactory(null), ReferencingFactoryFinder.getMathTransformFactory(null)); }
} else { try { CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null); crs = crsFactory.createFromWKT(WKT); LOGGER.fine("ArcSDE CRS correctly parsed from layer " + sdeLayer.getName());
/** * Returns the {@linkplain CRSFactory CRS factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CRSFactory getCRSFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCRSFactory(hints); }
/** * Returns the {@linkplain CRSFactory CRS factory} singleton. * * @throws FactoryNotFoundException if no factory was found for the requested type. * @throws FactoryRegistryException if the factory can't be obtained for an other reason. */ public CRSFactory getCRSFactory() throws FactoryRegistryException { return ReferencingFactoryFinder.getCRSFactory(hints); }
/** Setup the factories using the hints provided by {@link #getHintsForTesting}. */ @Before public final void setUpFactories() { Hints hints = getHintsForTesting(); datumFactory = ReferencingFactoryFinder.getDatumFactory(hints); crsFactory = ReferencingFactoryFinder.getCRSFactory(hints); mtFactory = ReferencingFactoryFinder.getMathTransformFactory(hints); opFactory = ReferencingFactoryFinder.getCoordinateOperationFactory(hints); }
out.println("Testing classification names"); out.println("----------------------------"); final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null); final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
final DatumFactory datumFactory = ReferencingFactoryFinder.getDatumFactory(null); final CSFactory csFactory = ReferencingFactoryFinder.getCSFactory(null); final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null); final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
/** Tests a transformation on a {@link DirectPosition} object. */ @Test public void testDirectPositionTransform() throws FactoryException, TransformException { CoordinateReferenceSystem crs = ReferencingFactoryFinder.getCRSFactory(null).createFromWKT(WKT.UTM_10N); MathTransform t = ReferencingFactoryFinder.getCoordinateOperationFactory(null) .createOperation(DefaultGeographicCRS.WGS84, crs) .getMathTransform(); DirectPosition position = new GeneralDirectPosition(-123, 55); position = t.transform(position, position); position = t.inverse().transform(position, position); assertEquals(-123, position.getOrdinate(0), 1E-6); assertEquals(55, position.getOrdinate(1), 1E-6); }
final MathTransform2D t; final CoordinateReferenceSystem crs; crs = ReferencingFactoryFinder.getCRSFactory(null).createFromWKT(JTSTest.UTM_ZONE_10N); t = (MathTransform2D)
try { horizontalCRS = ReferencingFactoryFinder.getCRSFactory(null) .createGeographicCRS(properties, datum, horizontalCS); } catch (FactoryException e) {
try { targetCRS = ReferencingFactoryFinder.getCRSFactory(hints) .createCompoundCRS( Collections.singletonMap(
/** Tests the transformation of a single coordinate. */ @Test public void testTransformCoordinate() throws FactoryException, TransformException { Coordinate coord = new Coordinate(10, 10); AffineTransform at = AffineTransform.getScaleInstance(0.5, 1); MathTransform2D t = (MathTransform2D) ReferencingFactoryFinder.getMathTransformFactory(null) .createAffineTransform(new GeneralMatrix(at)); coord = JTS.transform(coord, coord, t); assertEquals(new Coordinate(5, 10), coord); coord = JTS.transform(coord, coord, t.inverse()); assertEquals(new Coordinate(10, 10), coord); CoordinateReferenceSystem crs = ReferencingFactoryFinder.getCRSFactory(null).createFromWKT(UTM_ZONE_10N); t = (MathTransform2D) ReferencingFactoryFinder.getCoordinateOperationFactory(null) .createOperation(DefaultGeographicCRS.WGS84, crs) .getMathTransform(); coord = new Coordinate(-123, 55); coord = JTS.transform(coord, coord, t); coord = JTS.transform(coord, coord, t.inverse()); assertEquals(-123, coord.x, EPS); assertEquals(55, coord.y, EPS); }
ReferencingFactoryFinder.getCRSFactory(null).createFromWKT(UTM_ZONE_10N); t = (MathTransform2D)
final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(hints); final DatumFactory datumFactory = ReferencingFactoryFinder.getDatumFactory(hints); final MathTransformFactory mtFactory =