1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.projection.proj;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.data.Bounds;
|
---|
7 | import org.openstreetmap.josm.data.projection.ProjectionConfigurationException;
|
---|
8 | import org.openstreetmap.josm.tools.Utils;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Equidistant cylindrical projection (EPSG code 9823).
|
---|
12 | * In the particular case where the {@code standard_parallel_1} is 0°, this projection is also called Plate Carree or Equirectangular.
|
---|
13 | * This is used in, for example, <cite>WGS84 / Plate Carree</cite> (EPSG:32662).
|
---|
14 | * <p>
|
---|
15 | * <b>References:</b>
|
---|
16 | * <ul>
|
---|
17 | * <li>John P. Snyder (Map Projections - A Working Manual,<br>
|
---|
18 | * U.S. Geological Survey Professional Paper 1395, 1987)</li>
|
---|
19 | * <li>"Coordinate Conversions and Transformations including Formulas",<br>
|
---|
20 | * EPSG Guidence Note Number 7 part 2, Version 24.</li>
|
---|
21 | * </ul>
|
---|
22 | *
|
---|
23 | * @author John Grange
|
---|
24 | * @author Martin Desruisseaux
|
---|
25 | *
|
---|
26 | * @see <A HREF="http://mathworld.wolfram.com/CylindricalEquidistantProjection.html">Cylindrical Equidistant projection on MathWorld</A>
|
---|
27 | * @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/equirectangular.html">"Equirectangular" on RemoteSensing.org</A>
|
---|
28 | * @since 13598
|
---|
29 | */
|
---|
30 | public class EquidistantCylindrical extends AbstractProj {
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Cosinus of the {@code "standard_parallel_1"} parameter.
|
---|
34 | */
|
---|
35 | private double cosStandardParallel;
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | public String getName() {
|
---|
39 | return tr("Equidistant Cylindrical (Plate Caree)");
|
---|
40 | }
|
---|
41 |
|
---|
42 | @Override
|
---|
43 | public String getProj4Id() {
|
---|
44 | return "eqc";
|
---|
45 | }
|
---|
46 |
|
---|
47 | @Override
|
---|
48 | public void initialize(ProjParameters params) throws ProjectionConfigurationException {
|
---|
49 | super.initialize(params);
|
---|
50 | if (params.lat_ts != null) {
|
---|
51 | cosStandardParallel = Math.cos(Utils.toRadians(Math.abs(params.lat_ts)));
|
---|
52 | } else {
|
---|
53 | // standard parallel is the equator (Plate Carree or Equirectangular)
|
---|
54 | cosStandardParallel = 1.0;
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | @Override
|
---|
59 | public double[] project(double latRad, double lonRad) {
|
---|
60 | return new double[] {lonRad * cosStandardParallel, latRad};
|
---|
61 | }
|
---|
62 |
|
---|
63 | @Override
|
---|
64 | public double[] invproject(double east, double north) {
|
---|
65 | return new double[] {north, east / cosStandardParallel};
|
---|
66 | }
|
---|
67 |
|
---|
68 | @Override
|
---|
69 | public Bounds getAlgorithmBounds() {
|
---|
70 | return new Bounds(-89, -180, 89, 180, false);
|
---|
71 | }
|
---|
72 | }
|
---|