org.geotools.referencing.ReferencingFactoryFinder Java Examples
The following examples show how to use
org.geotools.referencing.ReferencingFactoryFinder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OperationMethodCrsProvider.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@Override public CoordinateReferenceSystem getCRS(final GeoPos referencePos, ParameterValueGroup parameters, GeodeticDatum datum) throws FactoryException { final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null); // in some cases, depending on the parameters set, the effective transformation can be different // from the transformation given by the OperationMethod. // So we create a new one final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null); final MathTransform transform = mtFactory.createParameterizedTransform(parameters); final DefaultOperationMethod operationMethod = new DefaultOperationMethod(transform); final Conversion conversion = new DefiningConversion(AbstractIdentifiedObject.getProperties(operationMethod), operationMethod, transform); final HashMap<String, Object> baseCrsProperties = new HashMap<String, Object>(); baseCrsProperties.put("name", datum.getName().getCode()); GeographicCRS baseCrs = crsFactory.createGeographicCRS(baseCrsProperties, datum, DefaultEllipsoidalCS.GEODETIC_2D); final HashMap<String, Object> projProperties = new HashMap<String, Object>(); projProperties.put("name", conversion.getName().getCode() + " / " + datum.getName().getCode()); return crsFactory.createProjectedCRS(projProperties, baseCrs, conversion, DefaultCartesianCS.PROJECTED); }
Example #2
Source File: AbstractUTMCrsProvider.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
CoordinateReferenceSystem createCrs(String crsName, OperationMethod method, ParameterValueGroup parameters, GeodeticDatum datum) throws FactoryException { final CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null); final CoordinateOperationFactory coFactory = ReferencingFactoryFinder.getCoordinateOperationFactory(null); final HashMap<String, Object> projProperties = new HashMap<String, Object>(); projProperties.put("name", crsName + " / " + datum.getName().getCode()); final Conversion conversion = coFactory.createDefiningConversion(projProperties, method, parameters); final HashMap<String, Object> baseCrsProperties = new HashMap<String, Object>(); baseCrsProperties.put("name", datum.getName().getCode()); final GeographicCRS baseCrs = crsFactory.createGeographicCRS(baseCrsProperties, datum, DefaultEllipsoidalCS.GEODETIC_2D); return crsFactory.createProjectedCRS(projProperties, baseCrs, conversion, DefaultCartesianCS.PROJECTED); }
Example #3
Source File: CustomCrsPanel.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
public static Set<GeodeticDatum> createDatumSet() { DatumAuthorityFactory factory = ReferencingFactoryFinder.getDatumAuthorityFactory("EPSG", null); List<String> datumCodes = retrieveCodes(GeodeticDatum.class, factory); Set<GeodeticDatum> datumSet = new TreeSet<>(AbstractIdentifiedObject.NAME_COMPARATOR); for (String datumCode : datumCodes) { try { DefaultGeodeticDatum geodeticDatum = (DefaultGeodeticDatum) factory.createGeodeticDatum(datumCode); if (geodeticDatum.getBursaWolfParameters().length != 0 || DefaultGeodeticDatum.isWGS84(geodeticDatum)) { datumSet.add(geodeticDatum); } } catch (FactoryException ignored) { } } return datumSet; }
Example #4
Source File: CustomCrsPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public static Set<AbstractCrsProvider> createCrsProviderSet() { MathTransformFactory factory = ReferencingFactoryFinder.getMathTransformFactory(null); Set<OperationMethod> methods = factory.getAvailableMethods(Projection.class); TreeSet<AbstractCrsProvider> crsProviderSet = new TreeSet<>(new CrsProviderComparator()); for (OperationMethod method : methods) { crsProviderSet.add(new OperationMethodCrsProvider(method)); } return crsProviderSet; }