Changeset 13639 in josm for trunk/src/org/openstreetmap/josm
 Timestamp:
 20180415T21:13:22+02:00 (18 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java
r12013 r13639 2 2 package org.openstreetmap.josm.data.projection.proj; 3 3 4 import static java.lang.Math.PI;5 4 import static java.lang.Math.abs; 6 5 import static java.lang.Math.atan; … … 11 10 import static java.lang.Math.sin; 12 11 import static java.lang.Math.sqrt; 13 import static java.lang.Math.tan;14 12 import static org.openstreetmap.josm.tools.I18n.tr; 13 import static org.openstreetmap.josm.tools.Utils.toRadians; 15 14 16 15 import org.openstreetmap.josm.data.Bounds; … … 18 17 import org.openstreetmap.josm.data.projection.Ellipsoid; 19 18 import org.openstreetmap.josm.data.projection.ProjectionConfigurationException; 20 import org.openstreetmap.josm.tools.Utils;21 19 22 20 /** 23 * Implementation of the Lambert Conformal Conic projection. 21 * Lambert Conical Conformal Projection. Areas and shapes are deformed as one moves away from standard parallels. 22 * The angles are true in a limited area. This projection is used for the charts of North America, France and Belgium. 23 * <p> 24 * This implementation provides transforms for two cases of the lambert conic conformal projection: 25 * <p> 26 * <ul> 27 * <li>{@code Lambert_Conformal_Conic_1SP} (EPSG code 9801)</li> 28 * <li>{@code Lambert_Conformal_Conic_2SP} (EPSG code 9802)</li> 29 * </ul> 30 * <p> 31 * For the 1SP case the latitude of origin is used as the standard parallel (SP). 32 * To use 1SP with a latitude of origin different from the SP, use the 2SP and set the SP1 to the single SP. 33 * The {@code "standard_parallel_2"} parameter is optional and will be given the same value 34 * as {@code "standard_parallel_1"} if not set (creating a 1 standard parallel projection). 35 * <p> 36 * <b>References:</b> 37 * <ul> 38 * <li>John P. Snyder (Map Projections  A Working Manual,<br>U.S. Geological Survey Professional Paper 1395, 1987)</li> 39 * <li>"Coordinate Conversions and Transformations including Formulas",<br>EPSG Guidence Note Number 7, Version 19.</li> 40 * </ul> 24 41 * 25 42 * @author Pieren 43 * @author André Gosselin 44 * @author Martin Desruisseaux (PMO, IRD) 45 * @author Rueben Schulz 46 * 47 * @see <A HREF="http://mathworld.wolfram.com/LambertConformalConicProjection.html">Lambert conformal conic projection on MathWorld</A> 48 * @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/lambert_conic_conformal_1sp.html">lambert_conic_conformal_1sp</A> 49 * @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/lambert_conic_conformal_2sp.html">lambert_conic_conformal_2sp</A> 50 * 51 * @since 13639 (align implementation with proj.4 / GeoTools) 52 * @since 4285 (reworked from Lambert / LambertCC9Zones) 53 * @since 2304 (initial implementation by Pieren) 26 54 */ 27 55 public class LambertConformalConic extends AbstractProj { … … 87 115 */ 88 116 protected double n; 117 89 118 /** 90 119 * projection factor 91 120 */ 92 121 protected double f; 93 /** 94 * radius of the parallel of latitude of the false origin (2SP) or at95 * natural origin (1SP)122 123 /** 124 * radius of the parallel of latitude of the false origin (2SP) or at natural origin (1SP) 96 125 */ 97 126 protected double r0; … … 109 138 throw new ProjectionConfigurationException(tr("Parameter ''{0}'' required.", Param.lat_0.key)); 110 139 if (params.lat1 != null && params.lat2 != null) { 111 initialize2SP(params.lat0, params.lat1, params.lat2); 140 this.params = new Parameters2SP(params.lat0, params.lat1, params.lat2); 141 initialize2SP(toRadians(params.lat0), toRadians(params.lat1), toRadians(params.lat2)); 112 142 } else { 113 initialize1SP(params.lat0); 143 this.params = new Parameters1SP(params.lat0); 144 initialize1SP(toRadians(params.lat0)); 114 145 } 115 146 } … … 118 149 * Initialize for LCC with 2 standard parallels. 119 150 * 120 * @param lat0 latitude of false origin (in degrees)121 * @param lat1 latitude of first standard parallel (in degrees)122 * @param lat2 latitude of second standard parallel (in degrees)151 * @param lat0 latitude of false origin (in radians) 152 * @param lat1 latitude of first standard parallel (in radians) 153 * @param lat2 latitude of second standard parallel (in radians) 123 154 */ 124 155 private void initialize2SP(double lat0, double lat1, double lat2) { 125 this.params = new Parameters2SP(lat0, lat1, lat2); 126 127 final double m1 = m(Utils.toRadians(lat1)); 128 final double m2 = m(Utils.toRadians(lat2)); 129 130 final double t1 = t(Utils.toRadians(lat1)); 131 final double t2 = t(Utils.toRadians(lat2)); 132 final double tf = t(Utils.toRadians(lat0)); 133 134 n = (log(m1)  log(m2)) / (log(t1)  log(t2)); 135 f = m1 / (n * pow(t1, n)); 136 r0 = f * pow(tf, n); 156 157 final double cosphi1 = cos(lat1); 158 final double sinphi1 = sin(lat1); 159 160 final double cosphi2 = cos(lat2); 161 final double sinphi2 = sin(lat2); 162 163 final double m1 = msfn(sinphi1, cosphi1); 164 final double m2 = msfn(sinphi2, cosphi2); 165 166 final double t0 = tsfn(lat0, sin(lat0)); 167 final double t1 = tsfn(lat1, sinphi1); 168 final double t2 = tsfn(lat2, sinphi2); 169 170 n = log(m1/m2) / log(t1/t2); 171 f = m1 * pow(t1, n) / n; 172 r0 = f * pow(t0, n); 137 173 } 138 174 … … 140 176 * Initialize for LCC with 1 standard parallel. 141 177 * 142 * @param lat0 latitude of natural origin (in degrees)178 * @param lat0 latitude of natural origin (in radians) 143 179 */ 144 180 private void initialize1SP(double lat0) { 145 this.params = new Parameters1SP(lat0); 146 final double lat0rad = Utils.toRadians(lat0); 147 148 final double m0 = m(lat0rad); 149 final double t0 = t(lat0rad); 150 151 n = sin(lat0rad); 152 f = m0 / (n * pow(t0, n)); 181 final double m0 = msfn(sin(lat0), cos(lat0)); 182 final double t0 = tsfn(lat0, sin(lat0)); 183 184 n = sin(lat0); 185 f = m0 * pow(t0, n) / n; 153 186 r0 = f * pow(t0, n); 154 }155 156 /**157 * auxiliary function t158 * @param latRad latitude in radians159 * @return result160 */161 protected double t(double latRad) {162 return tan(PI/4  latRad / 2.0)163 / pow((1.0  e * sin(latRad)) / (1.0 + e * sin(latRad)), e/2);164 }165 166 /**167 * auxiliary function m168 * @param latRad latitude in radians169 * @return result170 */171 protected double m(double latRad) {172 return cos(latRad) / (sqrt(1  e * e * pow(sin(latRad), 2)));173 187 } 174 188
Note: See TracChangeset
for help on using the changeset viewer.