Java Code Examples for org.opengis.referencing.crs.CRSAuthorityFactory#createCoordinateReferenceSystem()

The following examples show how to use org.opengis.referencing.crs.CRSAuthorityFactory#createCoordinateReferenceSystem() . 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: GeoHashGridProcessTest.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testInvertQueryNorthEastAxisOrder() throws Exception {
    Filter filter = ff.bbox("geom", 0, 0, 0, 0, "EPSG:4326");
    CRSAuthorityFactory   factory = CRS.getAuthorityFactory(false);
    CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:4326");
    ReferencedEnvelope env = new ReferencedEnvelope(2,3,0,1,crs);
    Query query = new Query();
    query.setFilter(filter);
    Query queryOut = process.invertQuery(env, query, null);
    assertEquals(ff.bbox("geom", 0, 2, 1, 3, "EPSG:4326"), queryOut.getFilter());
}
 
Example 2
Source File: CoordinateOperationMethods.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * For each {@link OperationMethod} (identified by their name), computes the union of the domain of validity
 * of all CRS using that operation method. The result is a map where keys are {@link OperationMethod} names,
 * and values are the union of the domain of validity of all CRS using that {@code OperationMethod}.
 *
 * <p>This is a costly operation.</p>
 *
 * @todo This method is not yet used. This is pending the implementation of {@code CRSAuthorityFactory} is SIS.
 *
 * @param  factory  the factory to use for getting CRS.
 * @return the union of domain of validity of all map projections using a method of the given name.
 * @throws FactoryException if an error occurred while fetching the list of CRS.
 */
public static Map<String, DefaultGeographicBoundingBox> computeUnionOfAllDomainOfValidity(
        final CRSAuthorityFactory factory) throws FactoryException
{
    final Map<String, DefaultGeographicBoundingBox> domainOfValidity = new HashMap<>();
    for (final String code : factory.getAuthorityCodes(GeneralDerivedCRS.class)) {
        final CoordinateReferenceSystem crs;
        try {
            crs = factory.createCoordinateReferenceSystem(code);
        } catch (FactoryException e) {
            continue;                                                   // Ignore and inspect the next element.
        }
        if (crs instanceof GeneralDerivedCRS) {
            final GeographicBoundingBox candidate = CRS.getGeographicBoundingBox(crs);
            if (candidate != null) {
                final String name = ((GeneralDerivedCRS) crs).getConversionFromBase().getMethod().getName().getCode();
                DefaultGeographicBoundingBox validity = domainOfValidity.get(name);
                if (validity == null) {
                    validity = new DefaultGeographicBoundingBox(candidate);
                    domainOfValidity.put(name, validity);
                } else {
                    validity.add(candidate);
                }
            }
        }
    }
    return domainOfValidity;
}