All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geotoolkit.referencing.factory.web.Auto42001 Maven / Gradle / Ivy

/*
 *    Geotoolkit.org - An Open Source Java GIS Toolkit
 *    http://www.geotoolkit.org
 *
 *    (C) 2004-2012, Open Source Geospatial Foundation (OSGeo)
 *    (C) 2009-2012, Geomatys
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */
package org.geotoolkit.referencing.factory.web;

import net.jcip.annotations.Immutable;
import org.opengis.parameter.ParameterValueGroup;


/**
 * Auto Universal Transverse Mercator ({@code AUTO:42001}).
 * In the notation below, "${var}" denotes a reference to the value of a variable
 * "{@code var}". The variables "{@code lat0}" and "{@code lon0}" are the central point of the
 * projection appearing in the CRS parameter of the map request. The coordinate operation method
 * uses ellipsoidal formulas.
 *
 * {@preformat wkt
 *   PROJCS["WGS 84 / Auto UTM",
 *     GEOGCS["WGS 84",
 *       DATUM["WGS_1984",
 *         SPHEROID["WGS_1984", 6378137, 298.257223563]],
 *       PRIMEM["Greenwich", 0],
 *       UNIT["Decimal_Degree", 0.0174532925199433]],
 *     PROJECTION["Transverse_Mercator"],
 *     PARAMETER["Latitude_of_Origin", 0],
 *     PARAMETER["Central_Meridian", ${central_meridian}],
 *     PARAMETER["False_Easting", 500000],
 *     PARAMETER["False_Northing", ${false_northing}],
 *     PARAMETER["Scale_Factor", 0.9996],
 *     UNIT["Meter", 1]]
 * }
 *
 * Where:
 *
 * {@preformat text
 *   ${zone}             = min(floor((${lon0} + 180.0) / 6.0) + 1, 60)
 *   ${central_meridian} = -183.0 + ${zone} * 6.0
 *   ${false_northing}   = (${lat0} >= 0.0) ? 0.0 : 10000000.0
 * }
 *
 * @author Jody Garnett (Refractions)
 * @author Rueben Schulz (UBC)
 * @author Martin Desruisseaux (IRD)
 * @version 3.00
 *
 * @since 2.2
 * @module
 */
@Immutable
final class Auto42001 extends Factlet {
    /**
     * A shared (thread-safe) instance.
     */
    public static final Auto42001 DEFAULT = new Auto42001();

    /**
     * Do not allows instantiation except the {@link #DEFAULT} constant.
     */
    private Auto42001() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int code() {
        return 42001;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getName() {
        return "WGS 84 / Auto UTM";
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getClassification() {
        return "Transverse_Mercator";
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void setProjectionParameters(final ParameterValueGroup parameters, final Code code) {
        final double zone            = Math.min(Math.floor((code.longitude + 180.0)/6.0)+1, 60);
        final double centralMeridian = -183.0 + zone*6.0;
        final double falseNorthing   = code.latitude >= 0.0 ? 0.0 : 10000000.0;

        parameters.parameter("latitude_of_origin").setValue(0.0);
        parameters.parameter("central_meridian")  .setValue(centralMeridian);
        parameters.parameter("false_easting")     .setValue(500000.0);
        parameters.parameter("false_northing")    .setValue(falseNorthing);
        parameters.parameter("scale_factor")      .setValue(0.9996);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy