├── .github └── workflows │ └── ci.yaml ├── .gitignore ├── .mvn ├── extensions.xml └── jgitver.config.xml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── HOWTORELEASE.txt ├── LICENSE ├── LICENSE.EPSG ├── README.md ├── about.md ├── core ├── pom.xml └── src │ ├── main │ └── java │ │ └── org │ │ └── locationtech │ │ └── proj4j │ │ ├── BasicCoordinateTransform.java │ │ ├── CRSFactory.java │ │ ├── ConvergenceFailureException.java │ │ ├── CoordinateReferenceSystem.java │ │ ├── CoordinateTransform.java │ │ ├── CoordinateTransformFactory.java │ │ ├── InvalidValueException.java │ │ ├── Proj4jException.java │ │ ├── ProjCoordinate.java │ │ ├── ProjectionException.java │ │ ├── Registry.java │ │ ├── UnknownAuthorityCodeException.java │ │ ├── UnsupportedParameterException.java │ │ ├── datum │ │ ├── AxisOrder.java │ │ ├── CTABLEV2.java │ │ ├── Datum.java │ │ ├── Ellipsoid.java │ │ ├── GeocentricConverter.java │ │ ├── Grid.java │ │ ├── NTV1.java │ │ ├── NTV2.java │ │ └── PrimeMeridian.java │ │ ├── geodesic │ │ ├── Constants.java │ │ ├── GeoMath.java │ │ ├── Geodesic.java │ │ ├── GeodesicData.java │ │ ├── GeodesicLine.java │ │ ├── GeodesicMask.java │ │ ├── GeographicErr.java │ │ └── Pair.java │ │ ├── io │ │ └── Proj4FileReader.java │ │ ├── parser │ │ ├── DatumParameters.java │ │ ├── Proj4Keyword.java │ │ └── Proj4Parser.java │ │ ├── proj │ │ ├── AiryProjection.java │ │ ├── AitoffProjection.java │ │ ├── AlbersProjection.java │ │ ├── AugustProjection.java │ │ ├── AzimuthalProjection.java │ │ ├── BipolarProjection.java │ │ ├── BoggsProjection.java │ │ ├── BonneProjection.java │ │ ├── CassiniProjection.java │ │ ├── CentralCylindricalProjection.java │ │ ├── CollignonProjection.java │ │ ├── ConicProjection.java │ │ ├── CrasterProjection.java │ │ ├── CylindricalEqualAreaProjection.java │ │ ├── CylindricalProjection.java │ │ ├── DenoyerProjection.java │ │ ├── Eckert1Projection.java │ │ ├── Eckert2Projection.java │ │ ├── Eckert4Projection.java │ │ ├── Eckert5Projection.java │ │ ├── Eckert6Projection.java │ │ ├── EqualAreaAzimuthalProjection.java │ │ ├── EquidistantAzimuthalProjection.java │ │ ├── EquidistantConicProjection.java │ │ ├── EulerProjection.java │ │ ├── ExtendedTransverseMercatorProjection.java │ │ ├── FaheyProjection.java │ │ ├── FoucautProjection.java │ │ ├── FoucautSinusoidalProjection.java │ │ ├── GallProjection.java │ │ ├── GaussProjection.java │ │ ├── GeocentProjection.java │ │ ├── GeostationarySatelliteProjection.java │ │ ├── Ginsburg8Projection.java │ │ ├── GnomonicAzimuthalProjection.java │ │ ├── GoodeProjection.java │ │ ├── HammerProjection.java │ │ ├── HatanoProjection.java │ │ ├── KavraiskyVProjection.java │ │ ├── KrovakProjection.java │ │ ├── LagrangeProjection.java │ │ ├── LambertAzimuthalEqualAreaProjection.java │ │ ├── LambertConformalConicProjection.java │ │ ├── LambertEqualAreaConicProjection.java │ │ ├── LandsatProjection.java │ │ ├── LarriveeProjection.java │ │ ├── LaskowskiProjection.java │ │ ├── LinearProjection.java │ │ ├── LongLatProjection.java │ │ ├── LoximuthalProjection.java │ │ ├── McBrydeThomasFlatPolarParabolicProjection.java │ │ ├── McBrydeThomasFlatPolarQuarticProjection.java │ │ ├── McBrydeThomasFlatPolarSine1Projection.java │ │ ├── McBrydeThomasFlatPolarSine2Projection.java │ │ ├── MercatorProjection.java │ │ ├── MillerProjection.java │ │ ├── ModStereoProjection.java │ │ ├── MolleweideProjection.java │ │ ├── Murdoch1Projection.java │ │ ├── Murdoch2Projection.java │ │ ├── Murdoch3Projection.java │ │ ├── NellHProjection.java │ │ ├── NellProjection.java │ │ ├── NewZealandMapGridProjection.java │ │ ├── NicolosiProjection.java │ │ ├── NullProjection.java │ │ ├── ObliqueMercatorProjection.java │ │ ├── ObliqueStereographicAlternativeProjection.java │ │ ├── OrthographicAzimuthalProjection.java │ │ ├── PerspectiveConicProjection.java │ │ ├── PerspectiveProjection.java │ │ ├── PlateCarreeProjection.java │ │ ├── PolyconicProjection.java │ │ ├── Projection.java │ │ ├── PseudoCylindricalProjection.java │ │ ├── PutninsP2Projection.java │ │ ├── PutninsP4Projection.java │ │ ├── PutninsP5PProjection.java │ │ ├── PutninsP5Projection.java │ │ ├── QuarticAuthalicProjection.java │ │ ├── RectangularPolyconicProjection.java │ │ ├── RobinsonProjection.java │ │ ├── SimpleConicProjection.java │ │ ├── SineTangentSeriesProjection.java │ │ ├── SinusoidalProjection.java │ │ ├── StereographicAzimuthalProjection.java │ │ ├── SwissObliqueMercatorProjection.java │ │ ├── TissotProjection.java │ │ ├── TransverseCylindricalEqualArea.java │ │ ├── TransverseMercatorProjection.java │ │ ├── TranverseCentralCylindricalProjection.java │ │ ├── UrmaevFlatPolarSinusoidalProjection.java │ │ ├── VanDerGrintenProjection.java │ │ ├── VitkovskyProjection.java │ │ ├── Wagner1Projection.java │ │ ├── Wagner2Projection.java │ │ ├── Wagner3Projection.java │ │ ├── Wagner4Projection.java │ │ ├── Wagner5Projection.java │ │ ├── Wagner7Projection.java │ │ ├── WerenskioldProjection.java │ │ └── WinkelTripelProjection.java │ │ ├── units │ │ ├── Angle.java │ │ ├── AngleFormat.java │ │ ├── DegreeUnit.java │ │ ├── Unit.java │ │ └── Units.java │ │ └── util │ │ ├── CRSCache.java │ │ ├── Complex.java │ │ ├── FloatPolarCoordinate.java │ │ ├── IntPolarCoordinate.java │ │ ├── Pair.java │ │ ├── PolarCoordinate.java │ │ ├── ProjectionMath.java │ │ └── ProjectionUtil.java │ └── test │ ├── java │ └── org │ │ └── locationtech │ │ └── proj4j │ │ ├── BaseCoordinateTransformTest.java │ │ ├── CoordinateTransformTest.java │ │ ├── CoordinateTransformTester.java │ │ ├── ExampleTest.java │ │ ├── FeatureTest.java │ │ ├── MetaCRSTest.java │ │ ├── Proj4JSTest.java │ │ ├── Proj4VariousTest.java │ │ ├── RepeatedTransformTest.java │ │ ├── TransformFailures.java │ │ ├── datum │ │ └── NTV2Test.java │ │ ├── io │ │ ├── CSVRecordParser.java │ │ ├── MetaCRSTestCase.java │ │ └── MetaCRSTestFileReader.java │ │ └── proj │ │ ├── ProjectionEqualityTest.java │ │ ├── ProjectionGridRoundTripper.java │ │ └── ProjectionGridTest.java │ └── resources │ ├── PROJ4_SPCS_EPSG_nad83.csv │ ├── PROJ4_SPCS_ESRI_nad83.csv │ ├── PROJ4_SPCS_nad27.csv │ ├── TestData.csv │ ├── proj4-epsg.csv │ └── proj4 │ └── nad │ ├── 100800401.gsb │ └── nzgd2kgrid0005.gsb ├── epsg ├── pom.xml └── src │ └── main │ └── resources │ └── proj4 │ ├── ellipsoid.csv │ ├── gcs.csv │ ├── gcs.override.csv │ ├── gdal_datum.csv │ ├── nad │ ├── epsg │ ├── esri │ ├── nad27 │ ├── nad83 │ ├── ntv1_can.dat │ ├── null │ └── world │ ├── pcs.csv │ ├── pcs.override.csv │ ├── prime_meridian.csv │ ├── projop_wparm.csv │ ├── unit_of_measure.csv │ └── wkt │ └── epsg.properties ├── geoapi ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── locationtech │ │ │ └── proj4j │ │ │ └── geoapi │ │ │ ├── AbstractCRS.java │ │ │ ├── Alias.java │ │ │ ├── AuthorityFactoryWrapper.java │ │ │ ├── Axis.java │ │ │ ├── DatumWrapper.java │ │ │ ├── EllipsoidWrapper.java │ │ │ ├── GeographicCRSWrapper.java │ │ │ ├── IdentifierEPSG.java │ │ │ ├── Importer.java │ │ │ ├── LocalizedString.java │ │ │ ├── OperationFactoryWrapper.java │ │ │ ├── OperationMethodWrapper.java │ │ │ ├── ParameterAccessor.java │ │ │ ├── ParameterWrapper.java │ │ │ ├── PositionWrapper.java │ │ │ ├── PrimeMeridianWrapper.java │ │ │ ├── ProjectedCRSWrapper.java │ │ │ ├── ProjectionWrapper2D.java │ │ │ ├── ProjectionWrapper3D.java │ │ │ ├── Services.java │ │ │ ├── SimpleCitation.java │ │ │ ├── TransformWrapper.java │ │ │ ├── TransformWrapper2D.java │ │ │ ├── TransformWrapper3D.java │ │ │ ├── UnconvertibleInstanceException.java │ │ │ ├── Units.java │ │ │ ├── Wrapper.java │ │ │ ├── Wrappers.java │ │ │ ├── package-info.java │ │ │ └── spi │ │ │ ├── AuthorityFactory.java │ │ │ ├── OperationFactory.java │ │ │ └── package-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── org.opengis.referencing.crs.CRSAuthorityFactory │ │ └── org.opengis.referencing.operation.CoordinateOperationFactory │ └── test │ └── java │ └── org │ └── locationtech │ └── proj4j │ └── geoapi │ ├── ServicesTest.java │ ├── TransformTest.java │ └── WrappersTest.java ├── locationtech_mark.png ├── notice.md └── pom.xml /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build-and-test: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Set up JDK 21 11 | uses: actions/setup-java@v4 12 | with: 13 | distribution: 'adopt' 14 | java-version: '21' 15 | - uses: actions/cache@v4 16 | with: 17 | path: ~/.m2/repository 18 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 19 | restore-keys: ${{ runner.os }}-maven- 20 | - name: Build with Maven 21 | run: mvn clean install 22 | - name: Remove proj4j artifacts from cache 23 | run: rm -rf $HOME/.m2/repository/org/locationtech/proj4j 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | index.html 2 | index.js 3 | package.html 4 | lib 5 | 6 | project/boot 7 | project/plugins/project 8 | project/plugins/target 9 | project/target 10 | target 11 | .ensime 12 | \#*# 13 | *~ 14 | .#* 15 | .lib 16 | *.aux.xml 17 | *.jar 18 | *.crc 19 | _SUCCESS 20 | 21 | *.pyc 22 | .project 23 | .classpath 24 | .cache 25 | .settings 26 | .history 27 | .idea 28 | .DS_Store 29 | *.iml 30 | *.swp 31 | *.swo 32 | *.sublime-* 33 | .vagrant 34 | 35 | .ensime* 36 | tags 37 | .vscode 38 | .metals 39 | -------------------------------------------------------------------------------- /.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | fr.brouillard.oss 5 | jgitver-maven-plugin 6 | 1.9.0 7 | 8 | 9 | -------------------------------------------------------------------------------- /.mvn/jgitver.config.xml: -------------------------------------------------------------------------------- 1 | 4 | MAVEN 5 | true 6 | false 7 | true 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This software is licensed under the Apache 2 license, quoted below. 2 | 3 | Copyright 2011-2016 Azavea [http://www.azavea.com] 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | use this file except in compliance with the License. You may obtain a copy of 7 | the License at 8 | 9 | [http://www.apache.org/licenses/LICENSE-2.0] 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | License for the specific language governing permissions and limitations under 15 | the License. 16 | 17 | ----- 18 | 19 | This software uses code from proj.4 [https://github.com/osgeo/proj.4], 20 | which is distributed under the MIT license: 21 | 22 | Copyright (c) 2000, Frank Warmerdam 23 | 24 | Permission is hereby granted, free of charge, to any person obtaining a 25 | copy of this software and associated documentation files (the "Software"), 26 | to deal in the Software without restriction, including without limitation 27 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 28 | and/or sell copies of the Software, and to permit persons to whom the 29 | Software is furnished to do so, subject to the following conditions: 30 | 31 | The above copyright notice and this permission notice shall be included 32 | in all copies or substantial portions of the Software. 33 | 34 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 35 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 37 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 39 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 40 | DEALINGS IN THE SOFTWARE. 41 | 42 | ----- 43 | 44 | Proj4J EPSG module contains resource files released under the EPSG database distribution license. 45 | For more details see LICENSE.EPSG file in the root of this repository. 46 | -------------------------------------------------------------------------------- /about.md: -------------------------------------------------------------------------------- 1 | ## About This Content 2 | 3 | February 6, 2017 4 | 5 | ### License 6 | 7 | The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the 8 | Content is provided to you under the terms and conditions of the Apache License, Version 2.0. A copy of the Apache 9 | License, Version 2.0 is available at 10 | [http://www.apache.org/licenses/LICENSE-2.0.txt](http://www.apache.org/licenses/LICENSE-2.0.txt) 11 | 12 | If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another 13 | party ("Redistributor") and different terms and conditions may apply to your use of any object code in the Content. 14 | Check the Redistributor’s license that was provided with the Content. If no such license exists, contact the 15 | Redistributor. Unless otherwise indicated below, the terms and conditions of the Apache License, Version 2.0 still apply 16 | to any source code in the Content and such source code may be obtained at 17 | [http://www.eclipse.org](http://www.eclipse.org). 18 | -------------------------------------------------------------------------------- /core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.locationtech.proj4j 6 | proj4j-modules 7 | 1.3.1-SNAPSHOT 8 | 9 | 10 | org.locationtech.proj4j 11 | proj4j 12 | bundle 13 | Proj4J 14 | Java port of the Proj.4 library for coordinate reprojection 15 | 16 | 17 | UTF-8 18 | org.locationtech.proj4j 19 | yyyyMMddHHmm 20 | ${maven.build.timestamp} 21 | 22 | 23 | 24 | 25 | org.locationtech.proj4j 26 | proj4j-epsg 27 | ${project.version} 28 | test 29 | 30 | 31 | junit 32 | junit 33 | test 34 | 35 | 36 | 37 | 38 | 39 | 40 | org.apache.felix 41 | maven-bundle-plugin 42 | 5.1.8 43 | true 44 | 45 | 46 | 47 | 48 | <_nouses>true 49 | <_snapshot>${osgi-version-qualifier} 50 | ${bundle-symbolicname} 51 | 52 | 53 | true 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/ConvergenceFailureException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | package org.locationtech.proj4j; 18 | 19 | /** 20 | * Signals that an interative mathematical algorithm has failed to converge. 21 | * This is usually due to values exceeding the 22 | * allowable bounds for the computation in which they are being used. 23 | * 24 | * @author mbdavis 25 | */ 26 | public class ConvergenceFailureException extends Proj4jException { 27 | 28 | public ConvergenceFailureException(String message) { 29 | super(message); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/CoordinateTransform.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * An interface for the operation of transforming 22 | * a {@link ProjCoordinate} from one {@link CoordinateReferenceSystem} 23 | * into a different one. 24 | * 25 | * @author Martin Davis 26 | * @see CoordinateTransformFactory 27 | */ 28 | public interface CoordinateTransform extends Serializable { 29 | 30 | CoordinateReferenceSystem getSourceCRS(); 31 | 32 | CoordinateReferenceSystem getTargetCRS(); 33 | 34 | 35 | /** 36 | * Tranforms a coordinate from the source {@link CoordinateReferenceSystem} 37 | * to the target one. 38 | * 39 | * @param src the input coordinate to transform 40 | * @param tgt the transformed coordinate 41 | * @return the target coordinate which was passed in 42 | * @throws Proj4jException if a computation error is encountered 43 | */ 44 | ProjCoordinate transform(ProjCoordinate src, ProjCoordinate tgt) 45 | throws Proj4jException; 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/CoordinateTransformFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j; 17 | 18 | /** 19 | * Creates {@link CoordinateTransform}s 20 | * from source and target {@link CoordinateReferenceSystem}s. 21 | * 22 | * @author mbdavis 23 | */ 24 | public class CoordinateTransformFactory { 25 | 26 | /** 27 | * Creates a transformation from a source CRS to a target CRS, 28 | * following the logic in PROJ.4. 29 | * The transformation may include any or all of inverse projection, datum transformation, 30 | * and reprojection, depending on the nature of the coordinate reference systems 31 | * provided. 32 | * 33 | * @param sourceCRS the source CoordinateReferenceSystem 34 | * @param targetCRS the target CoordinateReferenceSystem 35 | * @return a tranformation from the source CRS to the target CRS 36 | */ 37 | public CoordinateTransform createTransform(CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) { 38 | return new BasicCoordinateTransform(sourceCRS, targetCRS); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/InvalidValueException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j; 17 | 18 | /** 19 | * Signals that a parameter or computed internal variable 20 | * has a value which lies outside the 21 | * allowable bounds for the computation in which it is being used. 22 | * 23 | * @author mbdavis 24 | * 25 | */ 26 | public class InvalidValueException extends Proj4jException { 27 | 28 | public InvalidValueException(String message) { 29 | super(message); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/Proj4jException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j; 17 | 18 | /** 19 | * Signals that a situation or data state has been encountered 20 | * which prevents computation from proceeding, 21 | * or which would lead to erroneous results. 22 | *

23 | * This is the base class for all exceptions 24 | * thrown in the Proj4J API. 25 | * 26 | * @author mbdavis 27 | * 28 | */ 29 | public class Proj4jException extends RuntimeException 30 | { 31 | public Proj4jException() { 32 | } 33 | 34 | public Proj4jException(String message) { 35 | super(message); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/ProjectionException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j; 18 | 19 | import org.locationtech.proj4j.proj.Projection; 20 | 21 | /** 22 | * Signals that an erroneous situation has 23 | * occured during the computation of 24 | * a projected coordinate system value. 25 | * 26 | * @author mbdavis 27 | */ 28 | public class ProjectionException extends Proj4jException { 29 | 30 | public static String ERR_17 = "non-convergent inverse meridinal dist"; 31 | 32 | public ProjectionException() {} 33 | 34 | public ProjectionException(String message) { 35 | super(message); 36 | } 37 | 38 | public ProjectionException(Projection proj, String message) { 39 | this(proj.toString() + ": " + message); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/UnknownAuthorityCodeException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j; 18 | 19 | /** 20 | * Signals that an authority code is unknown 21 | * and cannot be mapped to a CRS definition. 22 | * 23 | * @author mbdavis 24 | */ 25 | public class UnknownAuthorityCodeException extends Proj4jException { 26 | public UnknownAuthorityCodeException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/UnsupportedParameterException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j; 18 | 19 | /** 20 | * Signals that a parameter in a CRS specification 21 | * is not currently supported, or unknown. 22 | * 23 | * @author mbdavis 24 | * 25 | */ 26 | public class UnsupportedParameterException extends Proj4jException 27 | { 28 | 29 | public UnsupportedParameterException(String message) { 30 | super(message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/geodesic/Constants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Implementation of the net.sf.geographiclib.Constants class 3 | * 4 | * Copyright (c) Charles Karney (2013) and licensed 5 | * under the MIT/X11 License. For more information, see 6 | * https://geographiclib.sourceforge.io/ 7 | **********************************************************************/ 8 | package org.locationtech.proj4j.geodesic; 9 | 10 | /** 11 | * Constants needed by GeographicLib. 12 | *

13 | * Define constants specifying the WGS84 ellipsoid. 14 | ***********************************************************************/ 15 | public class Constants { 16 | /** 17 | * The equatorial radius of WGS84 ellipsoid (6378137 m). 18 | **********************************************************************/ 19 | public static final double WGS84_a = 6378137; 20 | /** 21 | * The flattening of WGS84 ellipsoid (1/298.257223563). 22 | **********************************************************************/ 23 | public static final double WGS84_f = 1/298.257223563; 24 | 25 | private Constants() {} 26 | } -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/geodesic/GeographicErr.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Implementation of the net.sf.geographiclib.GeographicErr class 3 | * 4 | * Copyright (c) Charles Karney (2013) and licensed 5 | * under the MIT/X11 License. For more information, see 6 | * https://geographiclib.sourceforge.io/ 7 | **********************************************************************/ 8 | package org.locationtech.proj4j.geodesic; 9 | 10 | /** 11 | * Exception handling for GeographicLib. 12 | *

13 | * A class to handle exceptions. It's derived from RuntimeException so it 14 | * can be caught by the usual catch clauses. 15 | **********************************************************************/ 16 | public class GeographicErr extends RuntimeException { 17 | /** 18 | * Constructor 19 | *

20 | * @param msg a string message, which is accessible in the catch 21 | * clause via getMessage(). 22 | **********************************************************************/ 23 | public GeographicErr(String msg) { super(msg); } 24 | } -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/geodesic/Pair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Implementation of the net.sf.geographiclib.Pair class 3 | * 4 | * Copyright (c) Charles Karney (2013-2020) ∑ and licensed 5 | * under the MIT/X11 License. For more information, see 6 | * https://geographiclib.sourceforge.io/ 7 | **********************************************************************/ 8 | package org.locationtech.proj4j.geodesic; 9 | 10 | /** 11 | * A pair of double precision numbers. 12 | *

13 | * This duplicates the C++ class {@code std::pair}. 14 | **********************************************************************/ 15 | public class Pair { 16 | /** 17 | * The first member of the pair. 18 | **********************************************************************/ 19 | public double first; 20 | /** 21 | * The second member of the pair. 22 | **********************************************************************/ 23 | public double second; 24 | /** 25 | * Constructor 26 | *

27 | * @param first the first member of the pair. 28 | * @param second the second member of the pair. 29 | **********************************************************************/ 30 | public Pair(double first, double second) 31 | { this.first = first; this.second = second; } 32 | /** 33 | * No-argument Constructor 34 | **********************************************************************/ 35 | public Pair() {} 36 | } -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/AitoffProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import java.util.Objects; 23 | 24 | import org.locationtech.proj4j.ProjCoordinate; 25 | 26 | 27 | public class AitoffProjection extends PseudoCylindricalProjection { 28 | 29 | protected final static int AITOFF = 0; 30 | protected final static int WINKEL = 1; 31 | 32 | private boolean winkel = false; 33 | private double cosphi1 = 0; 34 | 35 | public AitoffProjection() { 36 | } 37 | 38 | public AitoffProjection(int type, double projectionLatitude) { 39 | this.projectionLatitude = projectionLatitude; 40 | winkel = type == WINKEL; 41 | } 42 | 43 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 44 | double c = 0.5 * lplam; 45 | double d = Math.acos(Math.cos(lpphi) * Math.cos(c)); 46 | 47 | if (d != 0) { 48 | out.x = 2. * d * Math.cos(lpphi) * Math.sin(c) * (out.y = 1. / Math.sin(d)); 49 | out.y *= d * Math.sin(lpphi); 50 | } else 51 | out.x = out.y = 0.0; 52 | if (winkel) { 53 | out.x = (out.x + lplam * cosphi1) * 0.5; 54 | out.y = (out.y + lpphi) * 0.5; 55 | } 56 | return out; 57 | } 58 | 59 | public void initialize() { 60 | super.initialize(); 61 | if (winkel) { 62 | //FIXME 63 | // if (pj_param(P->params, "tlat_1").i) 64 | // if ((cosphi1 = Math.cos(pj_param(P->params, "rlat_1").f)) == 0.) 65 | // throw new IllegalArgumentException("-22") 66 | // else /* 50d28' or acos(2/pi) */ 67 | cosphi1 = 0.636619772367581343; 68 | } 69 | } 70 | 71 | public boolean hasInverse() { 72 | return false; 73 | } 74 | 75 | public String toString() { 76 | return winkel ? "Winkel Tripel" : "Aitoff"; 77 | } 78 | 79 | @Override 80 | public boolean equals(Object that) { 81 | if (this == that) { 82 | return true; 83 | } 84 | if (that instanceof AitoffProjection) { 85 | AitoffProjection p = (AitoffProjection) that; 86 | return (winkel == p.winkel && super.equals(that)); 87 | } 88 | return false; 89 | } 90 | 91 | @Override 92 | public int hashCode() { 93 | return Objects.hash(winkel, super.hashCode()); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/AugustProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class AugustProjection extends Projection { 25 | 26 | private final static double M = 1.333333333333333; 27 | 28 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 29 | double t, c1, c, x1, x12, y1, y12; 30 | 31 | t = Math.tan(.5 * lpphi); 32 | c1 = Math.sqrt(1. - t * t); 33 | c = 1. + c1 * Math.cos(lplam *= .5); 34 | x1 = Math.sin(lplam) * c1 / c; 35 | y1 = t / c; 36 | out.x = M * x1 * (3. + (x12 = x1 * x1) - 3. * (y12 = y1 * y1)); 37 | out.y = M * y1 * (3. + 3. * x12 - y12); 38 | return out; 39 | } 40 | 41 | /** 42 | * Returns true if this projection is conformal 43 | */ 44 | public boolean isConformal() { 45 | return true; 46 | } 47 | 48 | public boolean hasInverse() { 49 | return false; 50 | } 51 | 52 | public String toString() { 53 | return "August Epicycloidal"; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/AzimuthalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | import java.util.Objects; 20 | 21 | import org.locationtech.proj4j.util.ProjectionMath; 22 | 23 | /** 24 | * The superclass for all azimuthal map projections 25 | */ 26 | public abstract class AzimuthalProjection extends Projection { 27 | 28 | public final static int NORTH_POLE = 1; 29 | public final static int SOUTH_POLE = 2; 30 | public final static int EQUATOR = 3; 31 | public final static int OBLIQUE = 4; 32 | 33 | protected int mode; 34 | protected double sinphi0, cosphi0; 35 | private double mapRadius = 90.0; 36 | 37 | public AzimuthalProjection() { 38 | this( Math.toRadians(45.0), Math.toRadians(45.0) ); 39 | } 40 | 41 | public AzimuthalProjection(double projectionLatitude, double projectionLongitude) { 42 | this.projectionLatitude = projectionLatitude; 43 | this.projectionLongitude = projectionLongitude; 44 | initialize(); 45 | } 46 | 47 | public void initialize() { 48 | super.initialize(); 49 | if (Math.abs(Math.abs(projectionLatitude) - ProjectionMath.HALFPI) < EPS10) 50 | mode = projectionLatitude < 0. ? SOUTH_POLE : NORTH_POLE; 51 | else if (Math.abs(projectionLatitude) > EPS10) { 52 | mode = OBLIQUE; 53 | sinphi0 = Math.sin(projectionLatitude); 54 | cosphi0 = Math.cos(projectionLatitude); 55 | } else 56 | mode = EQUATOR; 57 | } 58 | 59 | public boolean inside(double lon, double lat) { 60 | return ProjectionMath.greatCircleDistance( Math.toRadians(lon), Math.toRadians(lat), projectionLongitude, projectionLatitude) < Math.toRadians(mapRadius); 61 | } 62 | 63 | /** 64 | * Set the map radius (in degrees). 180 shows a hemisphere, 360 shows the whole globe. 65 | */ 66 | public void setMapRadius(double mapRadius) { 67 | this.mapRadius = mapRadius; 68 | } 69 | 70 | public double getMapRadius() { 71 | return mapRadius; 72 | } 73 | 74 | @Override 75 | public boolean equals(Object that) { 76 | if (this == that) { 77 | return true; 78 | } 79 | if (that instanceof AzimuthalProjection) { 80 | AzimuthalProjection p = (AzimuthalProjection) that; 81 | return ( 82 | mode == p.mode && 83 | sinphi0 == p.sinphi0 && 84 | cosphi0 == p.cosphi0 && 85 | mapRadius == p.mapRadius && 86 | super.equals(that)); 87 | } 88 | return false; 89 | } 90 | 91 | @Override 92 | public int hashCode() { 93 | return Objects.hash(mode, sinphi0, cosphi0, mapRadius, super.hashCode()); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/BoggsProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class BoggsProjection extends PseudoCylindricalProjection { 26 | 27 | private final static int NITER = 20; 28 | private final static double EPS = 1e-7; 29 | private final static double ONETOL = 1.000001; 30 | private final static double FXC = 2.00276; 31 | private final static double FXC2 = 1.11072; 32 | private final static double FYC = 0.49931; 33 | private final static double FYC2 = 1.41421356237309504880; 34 | 35 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 36 | double theta, th1, c; 37 | int i; 38 | 39 | theta = lpphi; 40 | if (Math.abs(Math.abs(lpphi) - ProjectionMath.HALFPI) < EPS) 41 | out.x = 0.; 42 | else { 43 | c = Math.sin(theta) * Math.PI; 44 | for (i = NITER; i > 0; --i) { 45 | theta -= th1 = (theta + Math.sin(theta) - c) / 46 | (1. + Math.cos(theta)); 47 | if (Math.abs(th1) < EPS) break; 48 | } 49 | theta *= 0.5; 50 | out.x = FXC * lplam / (1. / Math.cos(lpphi) + FXC2 / Math.cos(theta)); 51 | } 52 | out.y = FYC * (lpphi + FYC2 * Math.sin(theta)); 53 | return out; 54 | } 55 | 56 | /** 57 | * Returns true if this projection is equal area 58 | */ 59 | public boolean isEqualArea() { 60 | return true; 61 | } 62 | 63 | public boolean hasInverse() { 64 | return false; 65 | } 66 | 67 | public String toString() { 68 | return "Boggs Eumorphic"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/CentralCylindricalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class CentralCylindricalProjection extends CylindricalProjection { 27 | 28 | private final static double EPS10 = 1.e-10; 29 | 30 | public CentralCylindricalProjection() { 31 | minLatitude = Math.toRadians(-80); 32 | maxLatitude = Math.toRadians(80); 33 | } 34 | 35 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 36 | if (Math.abs(Math.abs(lpphi) - ProjectionMath.HALFPI) <= EPS10) throw new ProjectionException("F"); 37 | out.x = lplam; 38 | out.y = Math.tan(lpphi); 39 | return out; 40 | } 41 | 42 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 43 | out.y = Math.atan(xyy); 44 | out.x = xyx; 45 | return out; 46 | } 47 | 48 | public boolean hasInverse() { 49 | return true; 50 | } 51 | 52 | public String toString() { 53 | return "Central Cylindrical"; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/CollignonProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class CollignonProjection extends Projection { 27 | 28 | private final static double FXC = 1.12837916709551257390; 29 | private final static double FYC = 1.77245385090551602729; 30 | private final static double ONEEPS = 1.0000001; 31 | 32 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 33 | if ((out.y = 1. - Math.sin(lpphi)) <= 0.) 34 | out.y = 0.; 35 | else 36 | out.y = Math.sqrt(out.y); 37 | out.x = FXC * lplam * out.y; 38 | out.y = FYC * (1. - out.y); 39 | return out; 40 | } 41 | 42 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 43 | double lpphi = xyy / FYC - 1.; 44 | if (Math.abs(out.y = 1. - lpphi * lpphi) < 1.) 45 | out.y = Math.asin(lpphi); 46 | else if (Math.abs(lpphi) > ONEEPS) throw new ProjectionException("I"); 47 | else out.y = lpphi < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 48 | if ((out.x = 1. - Math.sin(lpphi)) <= 0.) 49 | out.x = 0.; 50 | else 51 | out.x = xyx / (FXC * Math.sqrt(out.x)); 52 | out.y = lpphi; 53 | return out; 54 | } 55 | 56 | /** 57 | * Returns true if this projection is equal area 58 | */ 59 | public boolean isEqualArea() { 60 | return true; 61 | } 62 | 63 | public boolean hasInverse() { 64 | return true; 65 | } 66 | 67 | public String toString() { 68 | return "Collignon"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/ConicProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | 20 | 21 | /** 22 | * A projection formed by projecting the sphere 23 | * onto a cone tangent, or secant, to the sphere 24 | * along any small circle (usually a mid-latitude parallel). 25 | * In the normal aspect (which is oblique for conic projections), 26 | * parallels are projected as concentric arcs of circles, 27 | * and meridians are projected as straight lines 28 | * radiating at uniform angular intervals from the apex of the flattened cone. 29 | */ 30 | public abstract class ConicProjection extends Projection { 31 | 32 | public String toString() { 33 | return "Conic"; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/CrasterProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class CrasterProjection extends Projection { 25 | 26 | private final static double XM = 0.97720502380583984317; 27 | private final static double RXM = 1.02332670794648848847; 28 | private final static double YM = 3.06998012383946546542; 29 | private final static double RYM = 0.32573500793527994772; 30 | private final static double THIRD = 0.333333333333333333; 31 | 32 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 33 | lpphi *= THIRD; 34 | out.x = XM * lplam * (2. * Math.cos(lpphi + lpphi) - 1.); 35 | out.y = YM * Math.sin(lpphi); 36 | return out; 37 | } 38 | 39 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 40 | out.y = 3. * Math.asin(xyy * RYM); 41 | out.x = xyx * RXM / (2. * Math.cos((out.y + out.y) * THIRD) - 1); 42 | return out; 43 | } 44 | 45 | /** 46 | * Returns true if this projection is equal area 47 | */ 48 | public boolean isEqualArea() { 49 | return true; 50 | } 51 | 52 | public boolean hasInverse() { 53 | return true; 54 | } 55 | 56 | public String toString() { 57 | return "Craster Parabolic (Putnins P4)"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/CylindricalEqualAreaProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class CylindricalEqualAreaProjection extends Projection { 27 | 28 | private double qp; 29 | private double[] apa; 30 | 31 | public CylindricalEqualAreaProjection() { 32 | this(0.0, 0.0, 0.0); 33 | } 34 | 35 | public CylindricalEqualAreaProjection(double projectionLatitude, double projectionLongitude, double trueScaleLatitude) { 36 | this.projectionLatitude = projectionLatitude; 37 | this.projectionLongitude = projectionLongitude; 38 | this.trueScaleLatitude = trueScaleLatitude; 39 | initialize(); 40 | } 41 | 42 | public void initialize() { 43 | super.initialize(); 44 | double t = trueScaleLatitude; 45 | 46 | scaleFactor = Math.cos(t); 47 | if (es != 0) { 48 | t = Math.sin(t); 49 | scaleFactor /= Math.sqrt(1. - es * t * t); 50 | apa = ProjectionMath.authset(es); 51 | qp = ProjectionMath.qsfn(1., e, one_es); 52 | } 53 | } 54 | 55 | public ProjCoordinate project(double lam, double phi, ProjCoordinate xy) { 56 | if (spherical) { 57 | xy.x = scaleFactor * lam; 58 | xy.y = Math.sin(phi) / scaleFactor; 59 | } else { 60 | xy.x = scaleFactor * lam; 61 | xy.y = .5 * ProjectionMath.qsfn(Math.sin(phi), e, one_es) / scaleFactor; 62 | } 63 | return xy; 64 | } 65 | 66 | public ProjCoordinate projectInverse(double x, double y, ProjCoordinate lp) { 67 | if (spherical) { 68 | double t; 69 | 70 | if ((t = Math.abs(y *= scaleFactor)) - EPS10 <= 1.) { 71 | if (t >= 1.) 72 | lp.y = y < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 73 | else 74 | lp.y = Math.asin(y); 75 | lp.x = x / scaleFactor; 76 | } else throw new ProjectionException(); 77 | } else { 78 | lp.y = ProjectionMath.authlat(Math.asin( 2. * y * scaleFactor / qp), apa); 79 | lp.x = x / scaleFactor; 80 | } 81 | return lp; 82 | } 83 | 84 | public boolean hasInverse() { 85 | return true; 86 | } 87 | 88 | public boolean isRectilinear() { 89 | return true; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/CylindricalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | 20 | 21 | /** 22 | * A projection 23 | * in which meridians are mapped to equally spaced vertical lines 24 | * and circles of latitude (parallels) are mapped to horizontal lines. 25 | */ 26 | public abstract class CylindricalProjection extends Projection { 27 | 28 | public boolean isRectilinear() { 29 | return true; 30 | } 31 | 32 | public String toString() { 33 | return "Cylindrical"; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/DenoyerProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | 25 | public class DenoyerProjection extends Projection { 26 | 27 | public final static double C0 = 0.95; 28 | public final static double C1 = -.08333333333333333333; 29 | public final static double C3 = 0.00166666666666666666; 30 | public final static double D1 = 0.9; 31 | public final static double D5 = 0.03; 32 | 33 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 34 | out.y = lpphi; 35 | out.x = lplam; 36 | double aphi = Math.abs(lplam); 37 | out.x *= Math.cos((C0 + aphi * (C1 + aphi * aphi * C3)) * 38 | (lpphi * (D1 + D5 * lpphi * lpphi * lpphi * lpphi))); 39 | return out; 40 | } 41 | 42 | public boolean parallelsAreParallel() { 43 | return true; 44 | } 45 | 46 | public boolean hasInverse() { 47 | return false; 48 | } 49 | 50 | public String toString() { 51 | return "Denoyer Semi-elliptical"; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Eckert1Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class Eckert1Projection extends Projection { 25 | 26 | private final static double FC = .92131773192356127802; 27 | private final static double RP = .31830988618379067154; 28 | 29 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 30 | out.x = FC * lplam * (1. - RP * Math.abs(lpphi)); 31 | out.y = FC * lpphi; 32 | return out; 33 | } 34 | 35 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 36 | out.y = xyy / FC; 37 | out.x = xyx / (FC * (1. - RP * Math.abs(out.y))); 38 | return out; 39 | } 40 | 41 | public boolean hasInverse() { 42 | return true; 43 | } 44 | 45 | public String toString() { 46 | return "Eckert I"; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Eckert2Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class Eckert2Projection extends Projection { 27 | 28 | private final static double FXC = 0.46065886596178063902; 29 | private final static double FYC = 1.44720250911653531871; 30 | private final static double C13 = 0.33333333333333333333; 31 | private final static double ONEEPS = 1.0000001; 32 | 33 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 34 | out.x = FXC * lplam * (out.y = Math.sqrt(4. - 3. * Math.sin(Math.abs(lpphi)))); 35 | out.y = FYC * (2. - out.y); 36 | if ( lpphi < 0.) out.y = -out.y; 37 | return out; 38 | } 39 | 40 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 41 | out.x = xyx / (FXC * ( out.y = 2. - Math.abs(xyy) / FYC) ); 42 | out.y = (4. - out.y * out.y) * C13; 43 | if (Math.abs(out.y) >= 1.) { 44 | if (Math.abs(out.y) > ONEEPS) throw new ProjectionException("I"); 45 | else 46 | out.y = out.y < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 47 | } else 48 | out.y = Math.asin(out.y); 49 | if (xyy < 0) 50 | out.y = -out.y; 51 | return out; 52 | } 53 | 54 | public boolean hasInverse() { 55 | return true; 56 | } 57 | 58 | public String toString() { 59 | return "Eckert II"; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Eckert4Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class Eckert4Projection extends Projection { 26 | 27 | private final static double C_x = .42223820031577120149; 28 | private final static double C_y = 1.32650042817700232218; 29 | private final static double RC_y = .75386330736002178205; 30 | private final static double C_p = 3.57079632679489661922; 31 | private final static double RC_p = .28004957675577868795; 32 | private final static double EPS = 1e-7; 33 | private final int NITER = 6; 34 | 35 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 36 | double p, V, s, c; 37 | int i; 38 | 39 | p = C_p * Math.sin(lpphi); 40 | V = lpphi * lpphi; 41 | lpphi *= 0.895168 + V * ( 0.0218849 + V * 0.00826809 ); 42 | for (i = NITER; i > 0; --i) { 43 | c = Math.cos(lpphi); 44 | s = Math.sin(lpphi); 45 | lpphi -= V = (lpphi + s * (c + 2.) - p) / 46 | (1. + c * (c + 2.) - s * s); 47 | if (Math.abs(V) < EPS) 48 | break; 49 | } 50 | if (i == 0) { 51 | out.x = C_x * lplam; 52 | out.y = lpphi < 0. ? -C_y : C_y; 53 | } else { 54 | out.x = C_x * lplam * (1. + Math.cos(lpphi)); 55 | out.y = C_y * Math.sin(lpphi); 56 | } 57 | return out; 58 | } 59 | 60 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 61 | double c; 62 | 63 | out.y = ProjectionMath.asin(xyy / C_y); 64 | out.x = xyx / (C_x * (1. + (c = Math.cos(out.y)))); 65 | out.y = ProjectionMath.asin((out.y + Math.sin(out.y) * (c + 2.)) / C_p); 66 | return out; 67 | } 68 | 69 | public boolean hasInverse() { 70 | return true; 71 | } 72 | 73 | public boolean isEqualArea() { 74 | return true; 75 | } 76 | 77 | public String toString() { 78 | return "Eckert IV"; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Eckert5Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class Eckert5Projection extends Projection { 25 | 26 | private final static double XF = 0.44101277172455148219; 27 | private final static double RXF = 2.26750802723822639137; 28 | private final static double YF = 0.88202554344910296438; 29 | private final static double RYF = 1.13375401361911319568; 30 | 31 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 32 | out.x = XF * (1. + Math.cos(lpphi)) * lplam; 33 | out.y = YF * lpphi; 34 | return out; 35 | } 36 | 37 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 38 | out.x = RXF * xyx / (1. + Math.cos( out.y = RYF * xyy)); 39 | return out; 40 | } 41 | 42 | public boolean hasInverse() { 43 | return true; 44 | } 45 | 46 | public String toString() { 47 | return "Eckert V"; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Eckert6Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | Copyright 2011 Martin Davis 18 | 19 | Licensed under the Apache License, Version 2.0 (the "License"); 20 | you may not use this file except in compliance with the License. 21 | You may obtain a copy of the License at 22 | 23 | http://www.apache.org/licenses/LICENSE-2.0 24 | 25 | Unless required by applicable law or agreed to in writing, software 26 | distributed under the License is distributed on an "AS IS" BASIS, 27 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 28 | See the License for the specific language governing permissions and 29 | limitations under the License. 30 | */package org.locationtech.proj4j.proj; 31 | 32 | import org.locationtech.proj4j.*; 33 | 34 | public class Eckert6Projection extends PseudoCylindricalProjection { 35 | 36 | private static final double n = 2.570796326794896619231321691; 37 | private static final double C_y = Math.sqrt((2) / n); 38 | private static final double C_x = C_y / 2; 39 | private static final int MAX_ITER = 8; 40 | private static final double LOOP_TOL = 1e-7; 41 | 42 | public ProjCoordinate project(double lam, double phi, ProjCoordinate xy) { 43 | 44 | int i; 45 | double k, V; 46 | k = n * Math.sin(phi); 47 | for (i = MAX_ITER; i > 0;) { 48 | phi -= V = (phi + Math.sin(phi) - k) / (1 + Math.cos(phi)); 49 | if (Math.abs(V) < LOOP_TOL) { 50 | break; 51 | } 52 | --i; 53 | } 54 | if (i == 0) { 55 | throw new ProjectionException("F_ERROR"); 56 | } 57 | 58 | xy.x = C_x * lam * (1 + Math.cos(phi)); 59 | xy.y = C_y * phi; 60 | return xy; 61 | } 62 | 63 | public ProjCoordinate projectInverse(double x, double y, ProjCoordinate lp) { 64 | y /= C_y; 65 | lp.y = Math.asin((y + Math.sin(y)) / n); 66 | lp.x = x / (C_x * (1 + Math.cos(y))); 67 | return lp; 68 | } 69 | 70 | public boolean hasInverse() { 71 | return true; 72 | } 73 | 74 | public boolean isEqualArea() { 75 | return true; 76 | } 77 | 78 | public String toString() { 79 | return "Eckert VI"; 80 | } 81 | } -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/EulerProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class EulerProjection extends SimpleConicProjection { 23 | 24 | public EulerProjection() { 25 | super( SimpleConicProjection.EULER ); 26 | } 27 | 28 | public String toString() { 29 | return "Euler"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/FaheyProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class FaheyProjection extends Projection { 25 | 26 | private final static double TOL = 1e-6; 27 | 28 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 29 | out.y = 1.819152 * ( out.x = Math.tan(0.5 * lpphi) ); 30 | out.x = 0.819152 * lplam * asqrt(1 - out.x * out.x); 31 | return out; 32 | } 33 | 34 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 35 | out.y = 2. * Math.atan(out.y /= 1.819152); 36 | out.x = Math.abs(out.y = 1. - xyy * xyy) < TOL ? 0. : 37 | xyx / (0.819152 * Math.sqrt(xyy)); 38 | return out; 39 | } 40 | 41 | private double asqrt(double v) { 42 | return (v <= 0) ? 0. : Math.sqrt(v); 43 | } 44 | 45 | public boolean hasInverse() { 46 | return true; 47 | } 48 | 49 | public String toString() { 50 | return "Fahey"; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/FoucautProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class FoucautProjection extends SineTangentSeriesProjection { 23 | 24 | public FoucautProjection() { 25 | super( 2., 2., true ); 26 | } 27 | 28 | public String toString() { 29 | return "Foucaut"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/FoucautSinusoidalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class FoucautSinusoidalProjection extends Projection { 27 | private double n, n1; 28 | 29 | private final static int MAX_ITER = 10; 30 | private final static double LOOP_TOL = 1e-7; 31 | 32 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 33 | double t; 34 | 35 | t = Math.cos(lpphi); 36 | out.x = lplam * t / (n + n1 * t); 37 | out.y = n * lpphi + n1 * Math.sin(lpphi); 38 | return out; 39 | } 40 | 41 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 42 | double V; 43 | int i; 44 | 45 | if (n != 0) { 46 | out.y = xyy; 47 | for (i = MAX_ITER; i > 0; --i) { 48 | out.y -= V = (n * out.y + n1 * Math.sin(out.y) - xyy ) / 49 | (n + n1 * Math.cos(out.y)); 50 | if (Math.abs(V) < LOOP_TOL) 51 | break; 52 | } 53 | if (i == 0) 54 | out.y = xyy < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 55 | } else 56 | out.y = ProjectionMath.asin(xyy); 57 | V = Math.cos(out.y); 58 | out.x = xyx * (n + n1 * V) / V; 59 | return out; 60 | } 61 | 62 | public void initialize() { 63 | super.initialize(); 64 | // n = pj_param(params, "dn").f; 65 | if (n < 0. || n > 1.) 66 | throw new ProjectionException("-99"); 67 | n1 = 1. - n; 68 | } 69 | 70 | public boolean hasInverse() { 71 | return true; 72 | } 73 | 74 | public String toString() { 75 | return "Foucaut Sinusoidal"; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/GallProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class GallProjection extends Projection { 25 | 26 | private final static double YF = 1.70710678118654752440; 27 | private final static double XF = 0.70710678118654752440; 28 | private final static double RYF = 0.58578643762690495119; 29 | private final static double RXF = 1.41421356237309504880; 30 | 31 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 32 | out.x = XF * lplam; 33 | out.y = YF * Math.tan(.5 * lpphi); 34 | return out; 35 | } 36 | 37 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 38 | out.x = RXF * xyx; 39 | out.y = 2. * Math.atan(xyy * RYF); 40 | return out; 41 | } 42 | 43 | public boolean hasInverse() { 44 | return true; 45 | } 46 | 47 | public String toString() { 48 | return "Gall (Gall Stereographic)"; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/GeocentProjection.java: -------------------------------------------------------------------------------- 1 | package org.locationtech.proj4j.proj; 2 | 3 | import org.locationtech.proj4j.ProjCoordinate; 4 | import org.locationtech.proj4j.datum.GeocentricConverter; 5 | 6 | public class GeocentProjection extends Projection { 7 | 8 | @Override 9 | public ProjCoordinate projectRadians(ProjCoordinate src, ProjCoordinate dst) { 10 | GeocentricConverter geocentricConverter = new GeocentricConverter(this.ellipsoid); 11 | geocentricConverter.convertGeodeticToGeocentric(dst); 12 | return dst; 13 | } 14 | 15 | @Override 16 | public ProjCoordinate inverseProjectRadians(ProjCoordinate src, ProjCoordinate dst) { 17 | GeocentricConverter geocentricConverter = new GeocentricConverter(this.ellipsoid); 18 | geocentricConverter.convertGeocentricToGeodetic(dst); 19 | return dst; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Ginsburg8Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class Ginsburg8Projection extends Projection { 25 | 26 | private final static double Cl = 0.000952426; 27 | private final static double Cp = 0.162388; 28 | private final static double C12 = 0.08333333333333333; 29 | 30 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 31 | double t = lpphi * lpphi; 32 | 33 | out.y = lpphi * (1. + t * C12); 34 | out.x = lplam * (1. - Cp * t); 35 | t = lplam * lplam; 36 | out.x *= (0.87 - Cl * t * t); 37 | return out; 38 | } 39 | 40 | public String toString() { 41 | return "Ginsburg VIII (TsNIIGAiK)"; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/GoodeProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class GoodeProjection extends Projection { 25 | 26 | private final static double Y_COR = 0.05280; 27 | private final static double PHI_LIM = .71093078197902358062; 28 | 29 | private SinusoidalProjection sinu = new SinusoidalProjection(); 30 | private MolleweideProjection moll = new MolleweideProjection(); 31 | 32 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 33 | if (Math.abs(lpphi) <= PHI_LIM) 34 | out = sinu.project(lplam, lpphi, out); 35 | else { 36 | out = moll.project(lplam, lpphi, out); 37 | out.y -= lpphi >= 0.0 ? Y_COR : -Y_COR; 38 | } 39 | return out; 40 | } 41 | 42 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 43 | if (Math.abs(xyy) <= PHI_LIM) 44 | out = sinu.projectInverse(xyx, xyy, out); 45 | else { 46 | xyy += xyy >= 0.0 ? Y_COR : -Y_COR; 47 | out = moll.projectInverse(xyx, xyy, out); 48 | } 49 | return out; 50 | } 51 | 52 | public boolean hasInverse() { 53 | return true; 54 | } 55 | 56 | public String toString() { 57 | return "Goode Homolosine"; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/HammerProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import java.util.Objects; 23 | 24 | import org.locationtech.proj4j.ProjCoordinate; 25 | import org.locationtech.proj4j.ProjectionException; 26 | 27 | public class HammerProjection extends PseudoCylindricalProjection { 28 | 29 | private double w = 0.5; 30 | private double m = 1; 31 | private double rm; 32 | 33 | public HammerProjection() { 34 | } 35 | 36 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate xy) { 37 | double cosphi, d; 38 | 39 | d = Math.sqrt(2./(1. + (cosphi = Math.cos(lpphi)) * Math.cos(lplam *= w))); 40 | xy.x = m * d * cosphi * Math.sin(lplam); 41 | xy.y = rm * d * Math.sin(lpphi); 42 | return xy; 43 | } 44 | 45 | public void initialize() { 46 | super.initialize(); 47 | if ((w = Math.abs(w)) <= 0.) 48 | throw new ProjectionException("-27"); 49 | else 50 | w = .5; 51 | if ((m = Math.abs(m)) <= 0.) 52 | throw new ProjectionException("-27"); 53 | else 54 | m = 1.; 55 | rm = 1. / m; 56 | m /= w; 57 | es = 0.; 58 | } 59 | 60 | /** 61 | * Returns true if this projection is equal area 62 | */ 63 | public boolean isEqualArea() { 64 | return true; 65 | } 66 | 67 | // Properties 68 | public void setW( double w ) { 69 | this.w = w; 70 | } 71 | 72 | public double getW() { 73 | return w; 74 | } 75 | 76 | public void setM( double m ) { 77 | this.m = m; 78 | } 79 | 80 | public double getM() { 81 | return m; 82 | } 83 | 84 | public String toString() { 85 | return "Hammer & Eckert-Greifendorff"; 86 | } 87 | 88 | @Override 89 | public boolean equals(Object that) { 90 | if (this == that) { 91 | return true; 92 | } 93 | if (that instanceof HammerProjection) { 94 | HammerProjection p = (HammerProjection) that; 95 | return ( 96 | m == p.m && 97 | w == p.w && 98 | super.equals(that)); 99 | } 100 | return false; 101 | } 102 | 103 | @Override 104 | public int hashCode() { 105 | return Objects.hash(m, w, super.hashCode()); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/HatanoProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class HatanoProjection extends Projection { 27 | 28 | private final static int NITER = 20; 29 | private final static double EPS = 1e-7; 30 | private final static double ONETOL = 1.000001; 31 | private final static double CN = 2.67595; 32 | private final static double CS = 2.43763; 33 | private final static double RCN = 0.37369906014686373063; 34 | private final static double RCS = 0.41023453108141924738; 35 | private final static double FYCN = 1.75859; 36 | private final static double FYCS = 1.93052; 37 | private final static double RYCN = 0.56863737426006061674; 38 | private final static double RYCS = 0.51799515156538134803; 39 | private final static double FXC = 0.85; 40 | private final static double RXC = 1.17647058823529411764; 41 | 42 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 43 | double th1, c; 44 | int i; 45 | 46 | c = Math.sin(lpphi) * (lpphi < 0. ? CS : CN); 47 | for (i = NITER; i > 0; --i) { 48 | lpphi -= th1 = (lpphi + Math.sin(lpphi) - c) / (1. + Math.cos(lpphi)); 49 | if (Math.abs(th1) < EPS) break; 50 | } 51 | out.x = FXC * lplam * Math.cos(lpphi *= .5); 52 | out.y = Math.sin(lpphi) * (lpphi < 0. ? FYCS : FYCN); 53 | return out; 54 | } 55 | 56 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 57 | double th; 58 | 59 | th = xyy * ( xyy < 0. ? RYCS : RYCN); 60 | if (Math.abs(th) > 1.) 61 | if (Math.abs(th) > ONETOL) throw new ProjectionException("I"); 62 | else th = th > 0. ? ProjectionMath.HALFPI : - ProjectionMath.HALFPI; 63 | else 64 | th = Math.asin(th); 65 | out.x = RXC * xyx / Math.cos(th); 66 | th += th; 67 | out.y = (th + Math.sin(th)) * (xyy < 0. ? RCS : RCN); 68 | if (Math.abs(out.y) > 1.) 69 | if (Math.abs(out.y) > ONETOL) throw new ProjectionException("I"); 70 | else out.y = out.y > 0. ? ProjectionMath.HALFPI : - ProjectionMath.HALFPI; 71 | else 72 | out.y = Math.asin(out.y); 73 | return out; 74 | } 75 | 76 | public boolean hasInverse() { 77 | return true; 78 | } 79 | 80 | public String toString() { 81 | return "Hatano Asymmetrical Equal Area"; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/KavraiskyVProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class KavraiskyVProjection extends SineTangentSeriesProjection { 23 | 24 | public KavraiskyVProjection() { 25 | super( 1.50488, 1.35439, false ); 26 | } 27 | 28 | public String toString() { 29 | return "Kavraisky V"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/LagrangeProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import java.util.Objects; 23 | 24 | import org.locationtech.proj4j.ProjCoordinate; 25 | import org.locationtech.proj4j.ProjectionException; 26 | import org.locationtech.proj4j.util.ProjectionMath; 27 | 28 | public class LagrangeProjection extends Projection { 29 | 30 | // Parameters 31 | private double hrw; 32 | private double rw = 1.4; 33 | private double a1; 34 | private double phi1; 35 | 36 | private final static double TOL = 1e-10; 37 | 38 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate xy) { 39 | double v, c; 40 | 41 | if ( Math.abs(Math.abs(lpphi) - ProjectionMath.HALFPI) < TOL) { 42 | xy.x = 0; 43 | xy.y = lpphi < 0 ? -2. : 2.; 44 | } else { 45 | lpphi = Math.sin(lpphi); 46 | v = a1 * Math.pow((1. + lpphi)/(1. - lpphi), hrw); 47 | if ((c = 0.5 * (v + 1./v) + Math.cos(lplam *= rw)) < TOL) 48 | throw new ProjectionException(); 49 | xy.x = 2. * Math.sin(lplam) / c; 50 | xy.y = (v - 1./v) / c; 51 | } 52 | return xy; 53 | } 54 | 55 | public void setW( double w ) { 56 | this.rw = w; 57 | } 58 | 59 | public double getW() { 60 | return rw; 61 | } 62 | 63 | public void initialize() { 64 | super.initialize(); 65 | if (rw <= 0) 66 | throw new ProjectionException("-27"); 67 | hrw = 0.5 * (rw = 1. / rw); 68 | phi1 = projectionLatitude1; 69 | if (Math.abs(Math.abs(phi1 = Math.sin(phi1)) - 1.) < TOL) 70 | throw new ProjectionException("-22"); 71 | a1 = Math.pow((1. - phi1)/(1. + phi1), hrw); 72 | } 73 | 74 | /** 75 | * Returns true if this projection is conformal 76 | */ 77 | public boolean isConformal() { 78 | return true; 79 | } 80 | 81 | public boolean hasInverse() { 82 | return false; 83 | } 84 | 85 | public String toString() { 86 | return "Lagrange"; 87 | } 88 | 89 | @Override 90 | public boolean equals(Object that) { 91 | if (this == that) { 92 | return true; 93 | } 94 | if (that instanceof LagrangeProjection) { 95 | LagrangeProjection p = (LagrangeProjection) that; 96 | return (rw == p.rw) && super.equals(that); 97 | } 98 | return false; 99 | } 100 | 101 | @Override 102 | public int hashCode() { 103 | return Objects.hash(rw, super.hashCode()); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/LambertEqualAreaConicProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.util.ProjectionMath; 23 | 24 | public class LambertEqualAreaConicProjection extends AlbersProjection { 25 | 26 | public LambertEqualAreaConicProjection() { 27 | this( false ); 28 | } 29 | 30 | public LambertEqualAreaConicProjection( boolean south ) { 31 | minLatitude = Math.toRadians(0); 32 | maxLatitude = Math.toRadians(90); 33 | projectionLatitude1 = south ? -ProjectionMath.QUARTERPI : ProjectionMath.QUARTERPI; 34 | projectionLatitude2 = south ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 35 | initialize(); 36 | } 37 | 38 | public String toString() { 39 | return "Lambert Equal Area Conic"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/LarriveeProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class LarriveeProjection extends Projection { 25 | 26 | private final static double SIXTH = .16666666666666666; 27 | 28 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 29 | out.x = 0.5 * lplam * (1. + Math.sqrt(Math.cos(lpphi))); 30 | out.y = lpphi / (Math.cos(0.5 * lpphi) * Math.cos(SIXTH * lplam)); 31 | return out; 32 | } 33 | 34 | public String toString() { 35 | return "Larrivee"; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/LaskowskiProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | 25 | public class LaskowskiProjection extends Projection { 26 | 27 | private final static double a10 = 0.975534; 28 | private final static double a12 = -0.119161; 29 | private final static double a32 = -0.0143059; 30 | private final static double a14 = -0.0547009; 31 | private final static double b01 = 1.00384; 32 | private final static double b21 = 0.0802894; 33 | private final static double b03 = 0.0998909; 34 | private final static double b41 = 0.000199025; 35 | private final static double b23 = -0.0285500; 36 | private final static double b05 = -0.0491032; 37 | 38 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 39 | double l2, p2; 40 | 41 | l2 = lplam * lplam; 42 | p2 = lpphi * lpphi; 43 | out.x = lplam * (a10 + p2 * (a12 + l2 * a32 + p2 * a14)); 44 | out.y = lpphi * (b01 + l2 * (b21 + p2 * b23 + l2 * b41) + 45 | p2 * (b03 + p2 * b05)); 46 | return out; 47 | } 48 | 49 | public String toString() { 50 | return "Laskowski"; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/LinearProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | import org.locationtech.proj4j.ProjCoordinate; 20 | 21 | 22 | public class LinearProjection extends Projection { 23 | 24 | public ProjCoordinate project(ProjCoordinate src, ProjCoordinate dst) { 25 | dst.x = src.x; 26 | dst.y = src.y; 27 | return dst; 28 | } 29 | 30 | public void transform(double[] srcPoints, int srcOffset, double[] dstPoints, int dstOffset, int numPoints) { 31 | for (int i = 0; i < numPoints; i++) { 32 | dstPoints[dstOffset++] = srcPoints[srcOffset++]; 33 | dstPoints[dstOffset++] = srcPoints[srcOffset++]; 34 | } 35 | } 36 | 37 | public ProjCoordinate inverseProject(ProjCoordinate src, ProjCoordinate dst) { 38 | dst.x = src.x; 39 | dst.y = src.y; 40 | return dst; 41 | } 42 | 43 | public void inverseTransform(double[] srcPoints, int srcOffset, double[] dstPoints, int dstOffset, int numPoints) { 44 | for (int i = 0; i < numPoints; i++) { 45 | dstPoints[dstOffset++] = srcPoints[srcOffset++]; 46 | dstPoints[dstOffset++] = srcPoints[srcOffset++]; 47 | } 48 | } 49 | 50 | public boolean hasInverse() { 51 | return true; 52 | } 53 | 54 | public boolean isRectilinear() { 55 | return true; 56 | } 57 | 58 | public String toString() { 59 | return "Linear"; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/LongLatProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | import org.locationtech.proj4j.units.Units; 20 | 21 | /** 22 | * A "projection" for geodetic coordinates in Decimal Degrees. 23 | */ 24 | public class LongLatProjection extends Projection 25 | { 26 | // TODO: implement projection methods (which are basically just no-ops) 27 | /* 28 | 29 | public Point2D.Double transformRadians( Point2D.Double src, Point2D.Double dst ) { 30 | dst.x = src.x; 31 | dst.y = src.y; 32 | return dst; 33 | } 34 | 35 | */ 36 | 37 | public String toString() { 38 | return "LongLat"; 39 | } 40 | 41 | public void initialize() 42 | { 43 | // units are always in Decimal Degrees 44 | unit = Units.DEGREES; 45 | totalScale = 1.0; 46 | } 47 | 48 | @Override public Boolean isGeographic() { 49 | return true; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/LoximuthalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class LoximuthalProjection extends PseudoCylindricalProjection { 26 | 27 | private final static double FC = .92131773192356127802; 28 | private final static double RP = .31830988618379067154; 29 | private final static double EPS = 1e-8; 30 | 31 | private double phi1; 32 | private double cosphi1; 33 | private double tanphi1; 34 | 35 | public LoximuthalProjection() { 36 | phi1 = Math.toRadians(40.0);//FIXME - param 37 | cosphi1 = Math.cos(phi1); 38 | tanphi1 = Math.tan(ProjectionMath.QUARTERPI + 0.5 * phi1); 39 | } 40 | 41 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 42 | double x; 43 | double y = lpphi - phi1; 44 | if (y < EPS) 45 | x = lplam * cosphi1; 46 | else { 47 | x = ProjectionMath.QUARTERPI + 0.5 * lpphi; 48 | if (Math.abs(x) < EPS || Math.abs(Math.abs(x) - ProjectionMath.HALFPI) < EPS) 49 | x = 0.; 50 | else 51 | x = lplam * y / Math.log( Math.tan(x) / tanphi1 ); 52 | } 53 | out.x = x; 54 | out.y = y; 55 | return out; 56 | } 57 | 58 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 59 | double latitude = xyy + phi1; 60 | double longitude; 61 | if (Math.abs(xyy) < EPS) 62 | longitude = xyx / cosphi1; 63 | else if (Math.abs( longitude = ProjectionMath.QUARTERPI + 0.5 * xyy ) < EPS || 64 | Math.abs(Math.abs(xyx) -ProjectionMath.HALFPI) < EPS) 65 | longitude = 0.; 66 | else 67 | longitude = xyx * Math.log( Math.tan(longitude) / tanphi1 ) / xyy; 68 | 69 | out.x = longitude; 70 | out.y = latitude; 71 | return out; 72 | } 73 | 74 | public boolean hasInverse() { 75 | return true; 76 | } 77 | 78 | public String toString() { 79 | return "Loximuthal"; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/McBrydeThomasFlatPolarParabolicProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class McBrydeThomasFlatPolarParabolicProjection extends Projection { 27 | 28 | private final static double CS = .95257934441568037152; 29 | private final static double FXC = .92582009977255146156; 30 | private final static double FYC = 3.40168025708304504493; 31 | private final static double C23 = .66666666666666666666; 32 | private final static double C13 = .33333333333333333333; 33 | private final static double ONEEPS = 1.0000001; 34 | 35 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 36 | out.y = Math.asin(CS * Math.sin(lpphi)); 37 | out.x = FXC * lplam * (2. * Math.cos(C23 * lpphi) - 1.); 38 | out.y = FYC * Math.sin(C13 * lpphi); 39 | return out; 40 | } 41 | 42 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 43 | out.y = xyy / FYC; 44 | if (Math.abs(out.y) >= 1.) { 45 | if (Math.abs(out.y) > ONEEPS) throw new ProjectionException("I"); 46 | else out.y = (out.y < 0.) ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 47 | } else 48 | out.y = Math.asin(out.y); 49 | out.x = xyx / ( FXC * (2. * Math.cos(C23 * (out.y *= 3.)) - 1.) ); 50 | if (Math.abs(out.y = Math.sin(out.y) / CS) >= 1.) { 51 | if (Math.abs(out.y) > ONEEPS) throw new ProjectionException("I"); 52 | else out.y = (out.y < 0.) ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 53 | } else 54 | out.y = Math.asin(out.y); 55 | return out; 56 | } 57 | 58 | public boolean hasInverse() { 59 | return true; 60 | } 61 | 62 | public String toString() { 63 | return "McBride-Thomas Flat-Polar Parabolic"; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/McBrydeThomasFlatPolarSine1Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class McBrydeThomasFlatPolarSine1Projection extends SineTangentSeriesProjection { 23 | 24 | public McBrydeThomasFlatPolarSine1Projection() { 25 | super( 1.48875, 1.36509, false ); 26 | } 27 | 28 | public String toString() { 29 | return "McBryde-Thomas Flat-Polar Sine (No. 1)"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/McBrydeThomasFlatPolarSine2Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class McBrydeThomasFlatPolarSine2Projection extends Projection { 26 | 27 | private final static int MAX_ITER = 10; 28 | private final static double LOOP_TOL = 1e-7; 29 | private final static double C1 = 0.45503; 30 | private final static double C2 = 1.36509; 31 | private final static double C3 = 1.41546; 32 | private final static double C_x = 0.22248; 33 | private final static double C_y = 1.44492; 34 | private final static double C1_2 = 0.33333333333333333333333333; 35 | 36 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 37 | double k, V, t; 38 | int i; 39 | 40 | k = C3 * Math.sin(lpphi); 41 | for (i = MAX_ITER; i > 0; i--) { 42 | t = lpphi / C2; 43 | out.y -= V = (C1 * Math.sin(t) + Math.sin(lpphi) - k) / 44 | (C1_2 * Math.cos(t) + Math.cos(lpphi)); 45 | if (Math.abs(V) < LOOP_TOL) 46 | break; 47 | } 48 | t = lpphi / C2; 49 | out.x = C_x * lplam * (1. + 3. * Math.cos(lpphi)/Math.cos(t) ); 50 | out.y = C_y * Math.sin(t); 51 | return out; 52 | } 53 | 54 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 55 | double t, s; 56 | 57 | out.y = C2 * (t = ProjectionMath.asin(xyy / C_y)); 58 | out.x = xyx / (C_x * (1. + 3. * Math.cos(out.y)/Math.cos(t))); 59 | out.y = ProjectionMath.asin((C1 * Math.sin(t) + Math.sin(out.y)) / C3); 60 | return out; 61 | } 62 | 63 | public boolean hasInverse() { 64 | return true; 65 | } 66 | 67 | public String toString() { 68 | return "McBryde-Thomas Flat-Pole Sine (No. 2)"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/MercatorProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class MercatorProjection extends CylindricalProjection { 26 | 27 | public MercatorProjection() { 28 | minLatitude = ProjectionMath.degToRad(-85); 29 | maxLatitude = ProjectionMath.degToRad(85); 30 | } 31 | 32 | public ProjCoordinate project(double lam, double phi, ProjCoordinate out) { 33 | if (spherical) { 34 | out.x = scaleFactor * lam; 35 | out.y = scaleFactor * Math.log(Math.tan(ProjectionMath.QUARTERPI + 0.5 * phi)); 36 | } else { 37 | out.x = scaleFactor * lam; 38 | out.y = -scaleFactor * Math.log(ProjectionMath.tsfn(phi, Math.sin(phi), e)); 39 | } 40 | return out; 41 | } 42 | 43 | public ProjCoordinate projectInverse(double x, double y, ProjCoordinate out) { 44 | if (spherical) { 45 | out.y = ProjectionMath.HALFPI - 2. * Math.atan(Math.exp(-y / scaleFactor)); 46 | out.x = x / scaleFactor; 47 | } else { 48 | out.y = ProjectionMath.phi2(Math.exp(-y / scaleFactor), e); 49 | out.x = x / scaleFactor; 50 | } 51 | return out; 52 | } 53 | 54 | public boolean hasInverse() { 55 | return true; 56 | } 57 | 58 | public boolean isRectilinear() { 59 | return true; 60 | } 61 | 62 | /** 63 | * Returns the ESPG code for this projection, or 0 if unknown. 64 | */ 65 | public int getEPSGCode() { 66 | return 9804; 67 | } 68 | 69 | public String toString() { 70 | return "Mercator"; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/MillerProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | 26 | public class MillerProjection extends CylindricalProjection { 27 | 28 | public MillerProjection() { 29 | } 30 | 31 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 32 | out.x = lplam; 33 | out.y = Math.log(Math.tan(ProjectionMath.QUARTERPI + lpphi * .4)) * 1.25; 34 | return out; 35 | } 36 | 37 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 38 | out.x = xyx; 39 | out.y = 2.5 * (Math.atan(Math.exp(.8 * xyy)) - ProjectionMath.QUARTERPI); 40 | return out; 41 | } 42 | 43 | public boolean hasInverse() { 44 | return true; 45 | } 46 | 47 | public String toString() { 48 | return "Miller Cylindrical"; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Murdoch1Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class Murdoch1Projection extends SimpleConicProjection { 23 | 24 | public Murdoch1Projection() { 25 | super( SimpleConicProjection.MURD1 ); 26 | } 27 | 28 | public String toString() { 29 | return "Murdoch I"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Murdoch2Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class Murdoch2Projection extends SimpleConicProjection { 23 | 24 | public Murdoch2Projection() { 25 | super( SimpleConicProjection.MURD2 ); 26 | } 27 | 28 | public String toString() { 29 | return "Murdoch II"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Murdoch3Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class Murdoch3Projection extends SimpleConicProjection { 23 | 24 | public Murdoch3Projection() { 25 | super( SimpleConicProjection.MURD3 ); 26 | } 27 | 28 | public String toString() { 29 | return "Murdoch III"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/NellHProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class NellHProjection extends Projection { 26 | 27 | private final static int NITER = 9; 28 | private final static double EPS = 1e-7; 29 | 30 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 31 | out.x = 0.5 * lplam * (1. + Math.cos(lpphi)); 32 | out.y = 2.0 * (lpphi - Math.tan(0.5 *lpphi)); 33 | return out; 34 | } 35 | 36 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 37 | double V, c, p; 38 | int i; 39 | 40 | p = 0.5 * xyy; 41 | for (i = NITER; i > 0 ; --i) { 42 | c = Math.cos(0.5 * xyy); 43 | out.y -= V = (xyy - Math.tan(xyy/2) - p)/(1. - 0.5/(c*c)); 44 | if (Math.abs(V) < EPS) 45 | break; 46 | } 47 | if (i == 0) { 48 | out.y = p < 0. ? -ProjectionMath.HALFPI : ProjectionMath.HALFPI; 49 | out.x = 2. * xyx; 50 | } else 51 | out.x = 2. * xyx / (1. + Math.cos(xyy)); 52 | return out; 53 | } 54 | 55 | public boolean hasInverse() { 56 | return true; 57 | } 58 | 59 | public String toString() { 60 | return "Nell-Hammer"; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/NellProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class NellProjection extends Projection { 26 | 27 | private final static int MAX_ITER = 10; 28 | private final static double LOOP_TOL = 1e-7; 29 | 30 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 31 | double k, V; 32 | int i; 33 | 34 | k = 2. * Math.sin(lpphi); 35 | V = lpphi * lpphi; 36 | out.y *= 1.00371 + V * (-0.0935382 + V * -0.011412); 37 | for (i = MAX_ITER; i > 0 ; --i) { 38 | out.y -= V = (lpphi + Math.sin(lpphi) - k) / 39 | (1. + Math.cos(lpphi)); 40 | if (Math.abs(V) < LOOP_TOL) 41 | break; 42 | } 43 | out.x = 0.5 * lplam * (1. + Math.cos(lpphi)); 44 | out.y = lpphi; 45 | return out; 46 | } 47 | 48 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 49 | double th, s; 50 | 51 | out.x = 2. * xyx / (1. + Math.cos(xyy)); 52 | out.y = ProjectionMath.asin(0.5 * (xyy + Math.sin(xyy))); 53 | return out; 54 | } 55 | 56 | public boolean hasInverse() { 57 | return true; 58 | } 59 | 60 | public String toString() { 61 | return "Nell"; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/NicolosiProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class NicolosiProjection extends Projection { 26 | 27 | private final static double EPS = 1e-10; 28 | 29 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 30 | if (Math.abs(lplam) < EPS) { 31 | out.x = 0; 32 | out.y = lpphi; 33 | } else if (Math.abs(lpphi) < EPS) { 34 | out.x = lplam; 35 | out.y = 0.; 36 | } else if (Math.abs(Math.abs(lplam) - ProjectionMath.HALFPI) < EPS) { 37 | out.x = lplam * Math.cos(lpphi); 38 | out.y = ProjectionMath.HALFPI * Math.sin(lpphi); 39 | } else if (Math.abs(Math.abs(lpphi) - ProjectionMath.HALFPI) < EPS) { 40 | out.x = 0; 41 | out.y = lpphi; 42 | } else { 43 | double tb, c, d, m, n, r2, sp; 44 | 45 | tb = ProjectionMath.HALFPI / lplam - lplam / ProjectionMath.HALFPI; 46 | c = lpphi / ProjectionMath.HALFPI; 47 | d = (1 - c * c)/((sp = Math.sin(lpphi)) - c); 48 | r2 = tb / d; 49 | r2 *= r2; 50 | m = (tb * sp / d - 0.5 * tb)/(1. + r2); 51 | n = (sp / r2 + 0.5 * d)/(1. + 1./r2); 52 | double x = Math.cos(lpphi); 53 | x = Math.sqrt(m * m + x * x / (1. + r2)); 54 | out.x = ProjectionMath.HALFPI * ( m + (lplam < 0. ? -x : x)); 55 | double y = Math.sqrt(n * n - (sp * sp / r2 + d * sp - 1.) / 56 | (1. + 1./r2)); 57 | out.y = ProjectionMath.HALFPI * ( n + (lpphi < 0. ? y : -y )); 58 | } 59 | return out; 60 | } 61 | 62 | public String toString() { 63 | return "Nicolosi Globular"; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/NullProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | import org.locationtech.proj4j.ProjCoordinate; 20 | 21 | /** 22 | * A projection which does nothing. Use this for drawing non-geographical overlays. 23 | */ 24 | public class NullProjection extends Projection { 25 | 26 | public NullProjection() 27 | { 28 | initialize(); 29 | } 30 | 31 | public ProjCoordinate project( ProjCoordinate src, ProjCoordinate dst ) { 32 | dst.x = src.x; 33 | dst.y = src.y; 34 | return dst; 35 | } 36 | 37 | public ProjCoordinate projectInverse( ProjCoordinate src, ProjCoordinate dst ) { 38 | dst.x = src.x; 39 | dst.y = src.y; 40 | return dst; 41 | } 42 | 43 | public boolean isRectilinear() { 44 | return true; 45 | } 46 | 47 | public String toString() { 48 | return "Null"; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/PerspectiveConicProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class PerspectiveConicProjection extends SimpleConicProjection { 23 | 24 | public PerspectiveConicProjection() { 25 | super( SimpleConicProjection.PCONIC ); 26 | } 27 | 28 | public String toString() { 29 | return "Perspective Conic"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/PlateCarreeProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | 20 | public class PlateCarreeProjection extends CylindricalProjection { 21 | 22 | public boolean hasInverse() { 23 | return true; 24 | } 25 | 26 | public boolean isRectilinear() { 27 | return true; 28 | } 29 | 30 | public String toString() { 31 | return "Plate Carr\u00e9e"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/PseudoCylindricalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.proj; 18 | 19 | 20 | /** 21 | * The superclass for all pseudo-cylindrical projections - eg. sinusoidal 22 | * These are projections where parallels are straight, but meridians aren't 23 | */ 24 | public class PseudoCylindricalProjection extends CylindricalProjection { 25 | 26 | public boolean isRectilinear() { 27 | return false; 28 | } 29 | 30 | public String toString() { 31 | return "Pseudo Cylindrical"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/PutninsP2Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class PutninsP2Projection extends Projection { 26 | 27 | private final static double C_x = 1.89490; 28 | private final static double C_y = 1.71848; 29 | private final static double C_p = 0.6141848493043784; 30 | private final static double EPS = 1e-10; 31 | private final static int NITER = 10; 32 | private final static double PI_DIV_3 = 1.0471975511965977; 33 | 34 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 35 | double p, c, s, V; 36 | int i; 37 | 38 | p = C_p * Math.sin(lpphi); 39 | s = lpphi * lpphi; 40 | out.y *= 0.615709 + s * ( 0.00909953 + s * 0.0046292 ); 41 | for (i = NITER; i > 0; --i) { 42 | c = Math.cos(lpphi); 43 | s = Math.sin(lpphi); 44 | out.y -= V = (lpphi + s * (c - 1.) - p) / 45 | (1. + c * (c - 1.) - s * s); 46 | if (Math.abs(V) < EPS) 47 | break; 48 | } 49 | if (i == 0) 50 | out.y = lpphi < 0 ? - PI_DIV_3 : PI_DIV_3; 51 | out.x = C_x * lplam * (Math.cos(lpphi) - 0.5); 52 | out.y = C_y * Math.sin(lpphi); 53 | return out; 54 | } 55 | 56 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 57 | double c; 58 | 59 | out.y = ProjectionMath.asin(xyy / C_y); 60 | out.x = xyx / (C_x * ((c = Math.cos(out.y)) - 0.5)); 61 | out.y = ProjectionMath.asin((out.y + Math.sin(out.y) * (c - 1.)) / C_p); 62 | return out; 63 | } 64 | 65 | public boolean hasInverse() { 66 | return true; 67 | } 68 | 69 | public String toString() { 70 | return "Putnins P2"; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/PutninsP4Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class PutninsP4Projection extends Projection { 26 | 27 | protected double C_x; 28 | protected double C_y; 29 | 30 | public PutninsP4Projection() { 31 | C_x = 0.874038744; 32 | C_y = 3.883251825; 33 | } 34 | 35 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate xy) { 36 | lpphi = ProjectionMath.asin(0.883883476 * Math.sin(lpphi)); 37 | xy.x = C_x * lplam * Math.cos(lpphi); 38 | xy.x /= Math.cos(lpphi *= 0.333333333333333); 39 | xy.y = C_y * Math.sin(lpphi); 40 | return xy; 41 | } 42 | 43 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate lp) { 44 | lp.y = ProjectionMath.asin(xyy / C_y); 45 | lp.x = xyx * Math.cos(lp.y) / C_x; 46 | lp.y *= 3.; 47 | lp.x /= Math.cos(lp.y); 48 | lp.y = ProjectionMath.asin(1.13137085 * Math.sin(lp.y)); 49 | return lp; 50 | } 51 | 52 | /** 53 | * Returns true if this projection is equal area 54 | */ 55 | public boolean isEqualArea() { 56 | return true; 57 | } 58 | 59 | public boolean hasInverse() { 60 | return true; 61 | } 62 | 63 | public String toString() { 64 | return "Putnins P4"; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/PutninsP5PProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | 23 | public class PutninsP5PProjection extends PutninsP5Projection { 24 | 25 | public PutninsP5PProjection() { 26 | A = 1.5; 27 | B = 0.5; 28 | } 29 | 30 | public String toString() { 31 | return "Putnins P5P"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/PutninsP5Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class PutninsP5Projection extends Projection { 25 | 26 | protected double A; 27 | protected double B; 28 | 29 | private final static double C = 1.01346; 30 | private final static double D = 1.2158542; 31 | 32 | public PutninsP5Projection() { 33 | A = 2; 34 | B = 1; 35 | } 36 | 37 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate xy) { 38 | xy.x = C * lplam * (A - B * Math.sqrt(1. + D * lpphi * lpphi)); 39 | xy.y = C * lpphi; 40 | return xy; 41 | } 42 | 43 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate lp) { 44 | lp.y = xyy / C; 45 | lp.x = xyx / (C * (A - B * Math.sqrt(1. + D * lp.y * lp.y))); 46 | return lp; 47 | } 48 | 49 | public boolean hasInverse() { 50 | return true; 51 | } 52 | 53 | public String toString() { 54 | return "Putnins P5"; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/QuarticAuthalicProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class QuarticAuthalicProjection extends SineTangentSeriesProjection { 23 | 24 | public QuarticAuthalicProjection() { 25 | super( 2., 2., false ); 26 | } 27 | 28 | public String toString() { 29 | return "Quartic Authalic"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/RectangularPolyconicProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class RectangularPolyconicProjection extends Projection { 25 | 26 | private double phi0; 27 | private double phi1; 28 | private double fxa; 29 | private double fxb; 30 | private boolean mode; 31 | 32 | private final static double EPS = 1e-9; 33 | 34 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 35 | double fa; 36 | 37 | if (mode) 38 | fa = Math.tan(lplam * fxb) * fxa; 39 | else 40 | fa = 0.5 * lplam; 41 | if (Math.abs(lpphi) < EPS) { 42 | out.x = fa + fa; 43 | out.y = - phi0; 44 | } else { 45 | out.y = 1. / Math.tan(lpphi); 46 | out.x = Math.sin(fa = 2. * Math.atan(fa * Math.sin(lpphi))) * out.y; 47 | out.y = lpphi - phi0 + (1. - Math.cos(fa)) * out.y; 48 | } 49 | return out; 50 | } 51 | 52 | public void initialize() { // rpoly 53 | super.initialize(); 54 | /*FIXME 55 | if ((mode = (phi1 = Math.abs(pj_param(params, "rlat_ts").f)) > EPS)) { 56 | fxb = 0.5 * Math.sin(phi1); 57 | fxa = 0.5 / fxb; 58 | } 59 | */ 60 | } 61 | 62 | public String toString() { 63 | return "Rectangular Polyconic"; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/SineTangentSeriesProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import java.util.Objects; 23 | 24 | import org.locationtech.proj4j.ProjCoordinate; 25 | import org.locationtech.proj4j.util.ProjectionMath; 26 | 27 | class SineTangentSeriesProjection extends ConicProjection { 28 | private double C_x; 29 | private double C_y; 30 | private double C_p; 31 | private boolean tan_mode; 32 | 33 | protected SineTangentSeriesProjection( double p, double q, boolean mode ) { 34 | es = 0.; 35 | C_x = q / p; 36 | C_y = p; 37 | C_p = 1/ q; 38 | tan_mode = mode; 39 | initialize(); 40 | } 41 | 42 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate xy) { 43 | double c; 44 | 45 | xy.x = C_x * lplam * Math.cos(lpphi); 46 | xy.y = C_y; 47 | lpphi *= C_p; 48 | c = Math.cos(lpphi); 49 | if (tan_mode) { 50 | xy.x *= c * c; 51 | xy.y *= Math.tan(lpphi); 52 | } else { 53 | xy.x /= c; 54 | xy.y *= Math.sin(lpphi); 55 | } 56 | return xy; 57 | } 58 | 59 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate lp) { 60 | double c; 61 | 62 | xyy /= C_y; 63 | c = Math.cos(lp.y = tan_mode ? Math.atan(xyy) : ProjectionMath.asin(xyy)); 64 | lp.y /= C_p; 65 | lp.x = xyx / (C_x * Math.cos(lp.y)); 66 | if (tan_mode) 67 | lp.x /= c * c; 68 | else 69 | lp.x *= c; 70 | return lp; 71 | } 72 | 73 | public boolean hasInverse() { 74 | return true; 75 | } 76 | 77 | @Override 78 | public boolean equals(Object that) { 79 | if (this == that) { 80 | return true; 81 | } 82 | if (that instanceof SineTangentSeriesProjection) { 83 | SineTangentSeriesProjection p = (SineTangentSeriesProjection) that; 84 | return ( 85 | C_x == p.C_x && 86 | C_y == p.C_y && 87 | C_p == p.C_p && 88 | tan_mode == p.tan_mode && 89 | super.equals(that)); 90 | } 91 | return false; 92 | } 93 | 94 | @Override 95 | public int hashCode() { 96 | return Objects.hash(C_x, C_y, C_p, tan_mode, super.hashCode()); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/SinusoidalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class SinusoidalProjection extends PseudoCylindricalProjection { 26 | 27 | public ProjCoordinate project(double lam, double phi, ProjCoordinate xy) { 28 | xy.x = lam * Math.cos(phi); 29 | xy.y = phi; 30 | return xy; 31 | } 32 | 33 | public ProjCoordinate projectInverse(double x, double y, ProjCoordinate lp) { 34 | lp.x = x / Math.cos(y); 35 | lp.y = y; 36 | return lp; 37 | } 38 | 39 | public double getWidth(double y) { 40 | return ProjectionMath.normalizeLongitude(Math.PI) * Math.cos(y); 41 | } 42 | 43 | public boolean hasInverse() { 44 | return true; 45 | } 46 | 47 | public boolean isEqualArea() { 48 | return true; 49 | } 50 | 51 | public String toString() { 52 | return "Sinusoidal"; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/TissotProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class TissotProjection extends SimpleConicProjection { 23 | 24 | public TissotProjection() { 25 | super( SimpleConicProjection.TISSOT ); 26 | } 27 | 28 | public String toString() { 29 | return "Tissot"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/TransverseCylindricalEqualArea.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class TransverseCylindricalEqualArea extends Projection { 25 | 26 | private double rk0; 27 | 28 | public TransverseCylindricalEqualArea() { 29 | initialize(); 30 | } 31 | 32 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 33 | out.x = rk0 * Math.cos(lpphi) * Math.sin(lplam); 34 | out.y = scaleFactor * (Math.atan2(Math.tan(lpphi), Math.cos(lplam)) - projectionLatitude); 35 | return out; 36 | } 37 | 38 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 39 | double t; 40 | 41 | out.y = xyy * rk0 + projectionLatitude; 42 | out.x *= scaleFactor; 43 | t = Math.sqrt(1. - xyx * xyx); 44 | out.y = Math.asin(t * Math.sin(xyy)); 45 | out.x = Math.atan2(xyx, t * Math.cos(xyy)); 46 | return out; 47 | } 48 | 49 | public void initialize() { // tcea 50 | super.initialize(); 51 | rk0 = 1 / scaleFactor; 52 | } 53 | 54 | public boolean isRectilinear() { 55 | return false; 56 | } 57 | 58 | public boolean hasInverse() { 59 | return true; 60 | } 61 | 62 | public String toString() { 63 | return "Transverse Cylindrical Equal Area"; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/TranverseCentralCylindricalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.ProjectionException; 24 | import org.locationtech.proj4j.util.ProjectionMath; 25 | 26 | public class TranverseCentralCylindricalProjection extends CylindricalProjection { 27 | 28 | public TranverseCentralCylindricalProjection() { 29 | minLongitude = ProjectionMath.degToRad(-60); 30 | maxLongitude = ProjectionMath.degToRad(60); 31 | } 32 | 33 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 34 | double b, bt; 35 | 36 | b = Math.cos(lpphi) * Math.sin(lplam); 37 | if ((bt = 1. - b * b) < EPS10) 38 | throw new ProjectionException("F"); 39 | out.x = b / Math.sqrt(bt); 40 | out.y = Math.atan2(Math.tan(lpphi), Math.cos(lplam)); 41 | return out; 42 | } 43 | 44 | public boolean isRectilinear() { 45 | return false; 46 | } 47 | 48 | public String toString() { 49 | return "Transverse Central Cylindrical"; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/UrmaevFlatPolarSinusoidalProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import java.util.Objects; 23 | 24 | import org.locationtech.proj4j.ProjCoordinate; 25 | import org.locationtech.proj4j.ProjectionException; 26 | import org.locationtech.proj4j.util.ProjectionMath; 27 | 28 | public class UrmaevFlatPolarSinusoidalProjection extends Projection { 29 | 30 | private final static double C_x = 0.8773826753; 31 | private final static double Cy = 1.139753528477; 32 | 33 | private double n = 0.8660254037844386467637231707;// wag1 34 | private double C_y; 35 | 36 | public UrmaevFlatPolarSinusoidalProjection() { 37 | } 38 | 39 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 40 | out.y = ProjectionMath.asin(n * Math.sin(lpphi)); 41 | out.x = C_x * lplam * Math.cos(lpphi); 42 | out.y = C_y * lpphi; 43 | return out; 44 | } 45 | 46 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 47 | xyy /= C_y; 48 | out.y = ProjectionMath.asin(Math.sin(xyy) / n); 49 | out.x = xyx / (C_x * Math.cos(xyy)); 50 | return out; 51 | } 52 | 53 | public boolean hasInverse() { 54 | return true; 55 | } 56 | 57 | public void initialize() { // urmfps 58 | super.initialize(); 59 | if (n <= 0. || n > 1.) 60 | throw new ProjectionException("-40"); 61 | C_y = Cy / n; 62 | } 63 | 64 | // Properties 65 | public void setN( double n ) { 66 | this.n = n; 67 | } 68 | 69 | public double getN() { 70 | return n; 71 | } 72 | 73 | public String toString() { 74 | return "Urmaev Flat-Polar Sinusoidal"; 75 | } 76 | 77 | @Override 78 | public boolean equals(Object that) { 79 | if (this == that) { 80 | return true; 81 | } 82 | if (that instanceof UrmaevFlatPolarSinusoidalProjection) { 83 | UrmaevFlatPolarSinusoidalProjection p = (UrmaevFlatPolarSinusoidalProjection) that; 84 | return (n == p.n) && super.equals(that); 85 | } 86 | return false; 87 | } 88 | 89 | @Override 90 | public int hashCode() { 91 | return Objects.hash(n, super.hashCode()); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/VitkovskyProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class VitkovskyProjection extends SimpleConicProjection { 23 | 24 | public VitkovskyProjection() { 25 | super( SimpleConicProjection.VITK1 ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Wagner1Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class Wagner1Projection extends UrmaevFlatPolarSinusoidalProjection { 23 | 24 | public String toString() { 25 | return "Wagner I"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Wagner2Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | import org.locationtech.proj4j.util.ProjectionMath; 24 | 25 | public class Wagner2Projection extends Projection { 26 | 27 | private final static double C_x = 0.92483; 28 | private final static double C_y = 1.38725; 29 | private final static double C_p1 = 0.88022; 30 | private final static double C_p2 = 0.88550; 31 | 32 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 33 | out.y = ProjectionMath.asin(C_p1 * Math.sin(C_p2 * lpphi)); 34 | out.x = C_x * lplam * Math.cos(lpphi); 35 | out.y = C_y * lpphi; 36 | return out; 37 | } 38 | 39 | public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { 40 | out.y = xyy / C_y; 41 | out.x = xyx / (C_x * Math.cos(out.y)); 42 | out.y = ProjectionMath.asin(Math.sin(out.y) / C_p1) / C_p2; 43 | return out; 44 | } 45 | 46 | public boolean hasInverse() { 47 | return true; 48 | } 49 | 50 | public String toString() { 51 | return "Wagner II"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Wagner3Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class Wagner3Projection extends PseudoCylindricalProjection { 25 | 26 | private final static double TWOTHIRD = 0.6666666666666666666667; 27 | 28 | private double C_x; 29 | 30 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate xy) { 31 | xy.x = C_x * lplam * Math.cos(TWOTHIRD * lpphi); 32 | xy.y = lpphi; 33 | return xy; 34 | } 35 | 36 | public ProjCoordinate projectInverse(double x, double y, ProjCoordinate lp) { 37 | lp.y = y; 38 | lp.x = x / (C_x * Math.cos(TWOTHIRD * lp.y)); 39 | return lp; 40 | } 41 | 42 | public void initialize() { 43 | super.initialize(); 44 | C_x = Math.cos(trueScaleLatitude) / Math.cos(2.*trueScaleLatitude/3.); 45 | es = 0.; 46 | } 47 | 48 | public boolean hasInverse() { 49 | return true; 50 | } 51 | 52 | public String toString() { 53 | return "Wagner III"; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Wagner4Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class Wagner4Projection extends MolleweideProjection { 23 | 24 | public Wagner4Projection() { 25 | super( MolleweideProjection.WAGNER4 ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Wagner5Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | public class Wagner5Projection extends MolleweideProjection { 23 | 24 | public Wagner5Projection() { 25 | super( MolleweideProjection.WAGNER5 ); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/Wagner7Projection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | import org.locationtech.proj4j.ProjCoordinate; 23 | 24 | public class Wagner7Projection extends Projection { 25 | 26 | public ProjCoordinate project(double lplam, double lpphi, ProjCoordinate out) { 27 | double theta, ct, D; 28 | 29 | theta = Math.asin(out.y = 0.90630778703664996 * Math.sin(lpphi)); 30 | out.x = 2.66723 * (ct = Math.cos(theta)) * Math.sin(lplam /= 3.); 31 | out.y *= 1.24104 * (D = 1/(Math.sqrt(0.5 * (1 + ct * Math.cos(lplam))))); 32 | out.x *= D; 33 | return out; 34 | } 35 | 36 | /** 37 | * Returns true if this projection is equal area 38 | */ 39 | public boolean isEqualArea() { 40 | return true; 41 | } 42 | 43 | public String toString() { 44 | return "Wagner VII"; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/WerenskioldProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | 23 | public class WerenskioldProjection extends PutninsP4Projection { 24 | 25 | public WerenskioldProjection() { 26 | C_x = 1; 27 | C_y = 4.442882938; 28 | } 29 | 30 | public String toString() { 31 | return "Werenskiold I"; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/proj/WinkelTripelProjection.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 | */ 20 | package org.locationtech.proj4j.proj; 21 | 22 | 23 | public class WinkelTripelProjection extends AitoffProjection { 24 | 25 | public WinkelTripelProjection() { 26 | super( WINKEL, 0.636619772367581343 ); 27 | } 28 | 29 | public String toString() { 30 | return "Winkel Tripel"; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/units/DegreeUnit.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2006, 2017 Jerry Huxtable, Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.locationtech.proj4j.units; 18 | 19 | 20 | public class DegreeUnit extends Unit { 21 | 22 | static final long serialVersionUID = -3212757578604686538L; 23 | 24 | private static AngleFormat format = new AngleFormat(AngleFormat.ddmmssPattern, true); 25 | 26 | public DegreeUnit() { 27 | super("degree", "degrees", "deg", 1); 28 | } 29 | 30 | public double parse(String s) throws NumberFormatException { 31 | try { 32 | return format.parse(s).doubleValue(); 33 | } 34 | catch (java.text.ParseException e) { 35 | throw new NumberFormatException(e.getMessage()); 36 | } 37 | } 38 | 39 | public String format(double n) { 40 | return format.format(n)+" "+abbreviation; 41 | } 42 | 43 | public String format(double n, boolean abbrev) { 44 | if (abbrev) 45 | return format.format(n)+" "+abbreviation; 46 | return format.format(n); 47 | } 48 | 49 | public String format(double x, double y, boolean abbrev) { 50 | if (abbrev) 51 | return format.format(x)+"/"+format.format(y)+" "+abbreviation; 52 | return format.format(x)+"/"+format.format(y); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/util/Complex.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.util; 17 | 18 | public final class Complex { 19 | 20 | public double r; 21 | 22 | public double i; 23 | 24 | public Complex(double r, double i) { 25 | this.r = r; 26 | this.i = i; 27 | } 28 | 29 | public Complex(Complex that) { 30 | this(that.r, that.i); 31 | } 32 | 33 | public int hashCode() { 34 | return Double.valueOf(r).hashCode() | 37 * Double.valueOf(i).hashCode(); 35 | } 36 | 37 | public boolean equals(Object that) { 38 | if (that instanceof Complex) { 39 | return ((Complex) that).r == r && ((Complex)that).i == i; 40 | } else { 41 | return false; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/util/FloatPolarCoordinate.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.util; 17 | 18 | import java.io.Serializable; 19 | 20 | public final class FloatPolarCoordinate implements Serializable { 21 | 22 | public float lam, phi; 23 | 24 | public FloatPolarCoordinate(FloatPolarCoordinate that) { 25 | this(that.lam, that.phi); 26 | } 27 | 28 | public FloatPolarCoordinate(float lam, float phi) { 29 | this.lam = lam; 30 | this.phi = phi; 31 | } 32 | 33 | @Override 34 | public int hashCode() { 35 | return new Float(lam).hashCode() | (17 * new Float(phi).hashCode()); 36 | } 37 | 38 | @Override 39 | public boolean equals(Object that) { 40 | if (that instanceof FloatPolarCoordinate) { 41 | FloatPolarCoordinate c = (FloatPolarCoordinate) that; 42 | return lam == c.lam && phi == c.phi; 43 | } else { 44 | return false; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/util/IntPolarCoordinate.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.util; 17 | 18 | import java.io.Serializable; 19 | 20 | public final class IntPolarCoordinate implements Serializable { 21 | 22 | public int lam, phi; 23 | 24 | public IntPolarCoordinate(IntPolarCoordinate that) { 25 | this(that.lam, that.phi); 26 | } 27 | 28 | public IntPolarCoordinate(int lam, int phi) { 29 | this.lam = lam; 30 | this.phi = phi; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return String.format("ILP %x:%x", lam, phi); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return lam | (17 * phi); 41 | } 42 | 43 | @Override 44 | public boolean equals(Object that) { 45 | if (that instanceof IntPolarCoordinate) { 46 | IntPolarCoordinate c = (IntPolarCoordinate) that; 47 | return lam == c.lam && phi == c.phi; 48 | } else { 49 | return false; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/util/Pair.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.util; 17 | 18 | import java.util.Objects; 19 | 20 | public class Pair { 21 | 22 | private A first; 23 | private B second; 24 | 25 | public Pair() { 26 | super(); 27 | } 28 | 29 | public Pair(A first, B second) { 30 | this.first = first; 31 | this.second = second; 32 | } 33 | 34 | public A fst() { 35 | return first; 36 | } 37 | 38 | public void setFirst(A first) { 39 | this.first = first; 40 | } 41 | 42 | public B snd() { 43 | return second; 44 | } 45 | 46 | public void setSecond(B second) { 47 | this.second = second; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return "<" + first + "," + second + ">"; 53 | } 54 | 55 | @Override 56 | public boolean equals(Object obj) { 57 | if (this == obj) 58 | return true; 59 | if (obj == null) 60 | return false; 61 | if (getClass() != obj.getClass()) 62 | return false; 63 | final Pair other = (Pair) obj; 64 | if (first == null) { 65 | if (other.first != null) 66 | return false; 67 | } else if (!first.equals(other.first)) 68 | return false; 69 | if (second == null) { 70 | if (other.second != null) 71 | return false; 72 | } else if (!second.equals(other.second)) 73 | return false; 74 | return true; 75 | } 76 | 77 | @Override 78 | public int hashCode() { 79 | return Objects.hash(this.getClass(), first, second); 80 | } 81 | 82 | public static Pair create(A first, B second) { 83 | return new Pair(first, second); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/util/PolarCoordinate.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.util; 17 | 18 | import java.io.Serializable; 19 | 20 | public final class PolarCoordinate implements Serializable { 21 | 22 | public double lam, phi; 23 | 24 | public PolarCoordinate(PolarCoordinate that) { 25 | this(that.lam, that.phi); 26 | } 27 | 28 | public PolarCoordinate(double lam, double phi) { 29 | this.lam = lam; 30 | this.phi = phi; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return String.format("<λ%f, φ%f>", lam, phi); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return new Double(lam).hashCode() | (17 * new Double(phi).hashCode()); 41 | } 42 | 43 | @Override 44 | public boolean equals(Object that) { 45 | if (that instanceof PolarCoordinate) { 46 | PolarCoordinate c = (PolarCoordinate) that; 47 | return lam == c.lam && phi == c.phi; 48 | } else { 49 | return false; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /core/src/main/java/org/locationtech/proj4j/util/ProjectionUtil.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.util; 17 | 18 | import org.locationtech.proj4j.ProjCoordinate; 19 | 20 | public class ProjectionUtil { 21 | public static String toString(ProjCoordinate p) { 22 | return "[" + p.x + ", " + p.y + "]"; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /core/src/test/java/org/locationtech/proj4j/RepeatedTransformTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package org.locationtech.proj4j; 17 | 18 | import org.junit.Test; 19 | import org.locationtech.proj4j.CRSFactory; 20 | import org.locationtech.proj4j.CoordinateReferenceSystem; 21 | import org.locationtech.proj4j.CoordinateTransform; 22 | import org.locationtech.proj4j.CoordinateTransformFactory; 23 | import org.locationtech.proj4j.ProjCoordinate; 24 | 25 | import static org.junit.Assert.assertTrue; 26 | 27 | public class RepeatedTransformTest { 28 | 29 | @Test 30 | public void testRepeatedTransform() { 31 | CRSFactory crsFactory = new CRSFactory(); 32 | 33 | CoordinateReferenceSystem src = crsFactory.createFromName("epsg:4326"); 34 | CoordinateReferenceSystem dest = crsFactory.createFromName("epsg:27700"); 35 | 36 | CoordinateTransformFactory ctf = new CoordinateTransformFactory(); 37 | CoordinateTransform transform = ctf.createTransform(src, dest); 38 | 39 | ProjCoordinate srcPt = new ProjCoordinate(0.899167, 51.357216); 40 | ProjCoordinate destPt = new ProjCoordinate(); 41 | 42 | transform.transform(srcPt, destPt); 43 | System.out.println(srcPt + " ==> " + destPt); 44 | 45 | // do it again 46 | ProjCoordinate destPt2 = new ProjCoordinate(); 47 | transform.transform(srcPt, destPt2); 48 | System.out.println(srcPt + " ==> " + destPt2); 49 | 50 | assertTrue(destPt.equals(destPt2)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /core/src/test/java/org/locationtech/proj4j/TransformFailures.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package org.locationtech.proj4j; 17 | 18 | /** 19 | * A class to run tests which are known to be failures. 20 | * This prevents Maven from running them automatically and reporting failures. 21 | * 22 | * @author mdavis 23 | */ 24 | public class TransformFailures extends BaseCoordinateTransformTest { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /core/src/test/java/org/locationtech/proj4j/proj/ProjectionEqualityTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2019 Azavea 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package org.locationtech.proj4j.proj; 17 | 18 | import org.locationtech.proj4j.CRSFactory; 19 | import org.locationtech.proj4j.CoordinateReferenceSystem; 20 | 21 | import static org.junit.Assert.assertEquals; 22 | import static org.junit.Assert.assertNotEquals; 23 | 24 | import org.junit.Test; 25 | 26 | /** 27 | * Tests that Projection equality is semantically correct 28 | */ 29 | public class ProjectionEqualityTest 30 | { 31 | private static CRSFactory csFactory = new CRSFactory(); 32 | 33 | @Test 34 | public void utmEquality() { 35 | 36 | CoordinateReferenceSystem cs1 = csFactory.createFromName("EPSG:26710"); 37 | CoordinateReferenceSystem cs2 = csFactory.createFromParameters(null, "+proj=utm +zone=10 +datum=NAD27 +units=m +no_defs"); 38 | assertEquals(cs1, cs2); 39 | 40 | CoordinateReferenceSystem cs3 = csFactory.createFromName("EPSG:26711"); 41 | assertNotEquals(cs1, cs3); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/test/java/org/locationtech/proj4j/proj/ProjectionGridTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2009, 2017 Martin Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package org.locationtech.proj4j.proj; 17 | 18 | import org.locationtech.proj4j.CRSFactory; 19 | import org.locationtech.proj4j.CoordinateReferenceSystem; 20 | 21 | import junit.framework.TestCase; 22 | import junit.textui.TestRunner; 23 | 24 | /** 25 | * Tests accuracy and correctness of projecting and reprojecting a grid of geographic coordinates. 26 | * 27 | * @author Martin Davis 28 | * 29 | */ 30 | public class ProjectionGridTest extends TestCase 31 | { 32 | static final double TOLERANCE = 0.00001; 33 | 34 | public static void main(String args[]) { 35 | TestRunner.run(ProjectionGridTest.class); 36 | } 37 | 38 | public ProjectionGridTest(String name) { super(name); } 39 | 40 | public void testAlbers() 41 | { 42 | runEPSG(3005); 43 | } 44 | 45 | public void testStatePlane() 46 | { 47 | // State-plane EPSG defs 48 | runEPSG(2759, 2930); 49 | } 50 | public void testStatePlaneND() 51 | { 52 | runEPSG(2265); 53 | } 54 | 55 | void runEPSG(int codeStart, int codeEnd) 56 | { 57 | for (int i = codeStart; i <= codeEnd; i++) { 58 | runEPSG(i); 59 | } 60 | } 61 | 62 | void runEPSG(int code) 63 | { 64 | run("epsg:" + code); 65 | } 66 | 67 | void run(String code) 68 | { 69 | CRSFactory csFactory = new CRSFactory(); 70 | CoordinateReferenceSystem cs = csFactory.createFromName(code); 71 | if (cs == null) 72 | return; 73 | ProjectionGridRoundTripper tripper = new ProjectionGridRoundTripper(cs); 74 | //tripper.setLevelDebug(true); 75 | boolean isOK = tripper.runGrid(TOLERANCE); 76 | double[] extent = tripper.getExtent(); 77 | 78 | System.out.println(code + " - " + cs.getParameterString()); 79 | System.out.println( 80 | " - extent: [ " + extent[0] + ", " + extent[1] + " : " + extent[2] + ", " + extent[3] + " ]"); 81 | System.out.println(" - tol: " + TOLERANCE); 82 | System.out.println(" - # pts run = " + tripper.getTransformCount()); 83 | 84 | assertTrue(isOK); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /core/src/test/resources/TestData.csv: -------------------------------------------------------------------------------- 1 | # Version: 00.12.00 2 | # This file is provided as part of the MetaCRS Project at the OSGeo. It is released into the public domain. 3 | # You use this file AT YOUR OWN RISK! The OSGeo, OSGeo Members, MetaCRS Members, and contributors to this file do not 4 | # make any warranties or statements about its accuracy or correctness. 5 | testName,testMethod,srcCrsAuth,srcCrs,tgtCrsAuth,tgtCrs,srcOrd1,srcOrd2,srcOrd3,tgtOrd1,tgtOrd2,tgtOrd3,tolOrd1,tolOrd2,tolOrd3,using,dataSource,dataCmnts,maintenanceCmnts 6 | WGS84 Geographic 2D to CSPC Z3 USFT NAD83,CRS2D,EPSG,4326,EPSG,2227,-121.3128278,37.95657778,,6327319.23,2171792.15,,0.05,0.05,,,Trimble Business Center 1.10,The latitude and longitude values provided as the source CRS ordinate values were obtained from Google Earth Version X for the approximate location of the KSN Inc. Office in Stockton California. These latitude and longitude values were calculated to California State Plane Coordinates Zone 3 United States Survey Feet using Version 1.10 of Trimble Business Center. The latitude and longitude values were inserted into TGO in Degrees-Minutes-Seconds format. These values were 37-57-23.68000 and -121.18-46.80000. The decimal degrees format for these latitude and longitude values provided in the Source CRS columns were converted by hand from the Degrees-Minutes-Seconds format by Landon Blake.,The latitude and longitude values provided as the source CRS ordinate values were obtained from Google Earth Version X for the approximate location of the KSN Inc. Office in Stockton California. These latitude and longitude values were calculated to California State Plane Coordinates Zone 3 United States Survey Feet using Version 1.10 of Trimble Business Center. The latitude and longitude values were inserted into TGO in Degrees-Minutes-Seconds format. These values were 37-57-23.68000 and -121.18-46.80000. The decimal degrees format for these latitude and longitude values provided in the Source CRS columns were converted by hand from the Degrees-Minutes-Seconds format by Landon Blake. 7 | -------------------------------------------------------------------------------- /core/src/test/resources/proj4/nad/100800401.gsb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/locationtech/proj4j/c856914930fc5b620ac4853784a5d6c733ae0d40/core/src/test/resources/proj4/nad/100800401.gsb -------------------------------------------------------------------------------- /core/src/test/resources/proj4/nad/nzgd2kgrid0005.gsb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/locationtech/proj4j/c856914930fc5b620ac4853784a5d6c733ae0d40/core/src/test/resources/proj4/nad/nzgd2kgrid0005.gsb -------------------------------------------------------------------------------- /epsg/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.locationtech.proj4j 6 | proj4j-modules 7 | 1.3.1-SNAPSHOT 8 | 9 | 10 | org.locationtech.proj4j 11 | proj4j-epsg 12 | jar 13 | Proj4J EPSG 14 | Java port of the Proj.4 library for coordinate reprojection 15 | 16 | 17 | 18 | Apache License, Version 2.0 19 | http://www.apache.org/licenses/LICENSE-2.0 20 | 21 | 22 | EPSG database distribution license 23 | https://raw.githubusercontent.com/locationtech/proj4j/master/LICENSE.EPSG 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /epsg/src/main/resources/proj4/gcs.override.csv: -------------------------------------------------------------------------------- 1 | "COORD_REF_SYS_CODE","COORD_REF_SYS_NAME","DATUM_CODE","DATUM_NAME","GREENWICH_DATUM","UOM_CODE","ELLIPSOID_CODE","PRIME_MERIDIAN_CODE","SHOW_CRS","DEPRECATED","COORD_SYS_CODE","COORD_OP_CODE","COORD_OP_CODE_MULTI","COORD_OP_METHOD_CODE","DX","DY","DZ","RX","RY","RZ","DS" 2 | # 3 | # NOTICE: The master version of this file is in the libgeotiff subversion at: 4 | # 5 | # https://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff/csv/gcs.override.csv 6 | # 7 | # Do *not* change other copies without upstreaming the results to libgeotiff. 8 | -------------------------------------------------------------------------------- /epsg/src/main/resources/proj4/nad/ntv1_can.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/locationtech/proj4j/c856914930fc5b620ac4853784a5d6c733ae0d40/epsg/src/main/resources/proj4/nad/ntv1_can.dat -------------------------------------------------------------------------------- /epsg/src/main/resources/proj4/nad/null: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/locationtech/proj4j/c856914930fc5b620ac4853784a5d6c733ae0d40/epsg/src/main/resources/proj4/nad/null -------------------------------------------------------------------------------- /epsg/src/main/resources/proj4/pcs.override.csv: -------------------------------------------------------------------------------- 1 | "COORD_REF_SYS_CODE","COORD_REF_SYS_NAME","UOM_CODE","SOURCE_GEOGCRS_CODE","COORD_OP_CODE","COORD_OP_METHOD_CODE","SHOW_CRS","DEPRECATED","COORD_SYS_CODE","PARAMETER_CODE_1","PARAMETER_VALUE_1","PARAMETER_UOM_1","PARAMETER_CODE_2","PARAMETER_VALUE_2","PARAMETER_UOM_2","PARAMETER_CODE_3","PARAMETER_VALUE_3","PARAMETER_UOM_3","PARAMETER_CODE_4","PARAMETER_VALUE_4","PARAMETER_UOM_4","PARAMETER_CODE_5","PARAMETER_VALUE_5","PARAMETER_UOM_5","PARAMETER_CODE_6","PARAMETER_VALUE_6","PARAMETER_UOM_6","PARAMETER_CODE_7","PARAMETER_VALUE_7","PARAMETER_UOM_7" 2 | # 3 | # NOTICE: The master version of this file is in the libgeotiff subversion at: 4 | # 5 | # https://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff/csv/pcs.override.csv 6 | # 7 | # Do *not* change other copies without upstreaming the results to libgeotiff. 8 | # 9 | # 10 | # 11 | # Adjust central meridian to be relative to prime meridian. 12 | # 13 | 26591,"Monte Mario (Rome) / Italy zone 1",9001,4806,18121,9807,1,1,4499,8801,0,9102,8802,-3.45233333333333,9102,8805,0.9996,9201,8806,1500000,9001,8807,0,9001,,,,,, 14 | 26592,"Monte Mario (Rome) / Italy zone 2",9001,4806,18122,9807,1,1,4499,8801,0,9102,8802,2.54766666666666,9102,8805,0.9996,9201,8806,2520000,9001,8807,0,9001,,,,,, 15 | # 16 | # 26799 is deprecated, because of the error in the false northing. However, 17 | # we "fix" the original to reduce problems folks would otherwise encounter. 18 | # 19 | 26799,"NAD27 / California zone VII",9003,4267,10408,9802,1,0,4497,8821,34.08,9110,8822,-118.2,9110,8823,34.25,9110,8824,33.52,9110,8826,4186692.58,9003,8827,4160926.74,9003,,, 20 | -------------------------------------------------------------------------------- /epsg/src/main/resources/proj4/prime_meridian.csv: -------------------------------------------------------------------------------- 1 | prime_meridian_code,prime_meridian_name,greenwich_longitude,uom_code,remarks,information_source,data_source,revision_date,change_id,deprecated 2 | 8901,Greenwich,0,9102,,,OGP,1995/06/02,1996.290,0 3 | 8902,Lisbon,-9.0754862,9110,,"Instituto Geografico e Cadastral; Lisbon",OGP,1995/06/02,1996.290,0 4 | 8903,Paris,2.5969213,9105,"Value adopted by IGN (Paris) in 1936. Equivalent to 2°20'14.025"". Preferred by EPSG to earlier value of 2°20'13.95"" (2.596898 grads) used by RGS London.","Institut Geographique National (IGN); Paris",OGP,2008/06/24,2008.045,0 5 | 8904,Bogota,-74.04513,9110,,"Instituto Geografico ""Augustin Cadazzi"" (IGAC); Bogota",OGP,1995/06/02,1996.290,0 6 | 8905,Madrid,-3.411658,9110,,,OGP,1995/06/02,1996.290,0 7 | 8906,Rome,12.27084,9110,,,OGP,1995/06/02,1996.290,0 8 | 8907,Bern,7.26225,9110,"1895 value. Newer value of 7°26'22.335"" determined in 1938.",Bundesamt für Landestopographie,OGP,2008/06/24,1996.290 2008.045,0 9 | 8908,Jakarta,106.482779,9110,,,OGP,1995/06/02,1996.290,0 10 | 8909,Ferro,-17.4,9110,Used in Austria and former Czechoslovakia.,,OGP,1995/06/02,1996.290,0 11 | 8910,Brussels,4.220471,9110,,,OGP,1995/06/02,1996.290,0 12 | 8911,Stockholm,18.03298,9110,,,OGP,1995/06/02,1996.290,0 13 | 8912,Athens,23.4258815,9110,Used in Greece for older mapping based on Hatt projection.,"Topography Department; National Technical University of Athens.",OGP,1997/06/16,,0 14 | 8913,Oslo,10.43225,9110,Formerly known as Kristiania or Christiania.,Statens Kartverk - Geodesidivisjonen,OGP,1999/10/20,,0 15 | 8914,Paris RGS,2.201395,9110,Value replaced by IGN (France) in 1936 - see code 8903. Equivalent to 2.596898 grads.,"Royal Geographic Society, London",OGP,2007/11/01,,0 16 | -------------------------------------------------------------------------------- /geoapi/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | org.locationtech.proj4j 6 | proj4j-modules 7 | 1.3.1-SNAPSHOT 8 | 9 | 10 | org.locationtech.proj4j 11 | proj4j-geoapi 12 | jar 13 | Proj4J GeoAPI 14 | GeoAPI wrappers for viewing PROJ4J as a GeoAPI implementation. 15 | 16 | 17 | 18 | desruisseaux 19 | Martin Desruisseaux 20 | https://github.com/desruisseaux 21 | 22 | 23 | 24 | 25 | 26 | org.opengis 27 | geoapi 28 | 3.0.2 29 | 30 | 31 | org.opengis 32 | geoapi-conformance 33 | 3.0.2 34 | test 35 | 36 | 37 | org.locationtech.proj4j 38 | proj4j 39 | ${project.version} 40 | 41 | 42 | org.locationtech.proj4j 43 | proj4j-epsg 44 | ${project.version} 45 | test 46 | 47 | 48 | tech.uom 49 | seshat 50 | 1.3 51 | test 52 | 53 | 54 | junit 55 | junit 56 | test 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.apache.maven.plugins 64 | maven-javadoc-plugin 65 | 66 | false 67 | all 68 | true 69 | true 70 | 71 | https://www.geoapi.org/3.0/javadoc/ 72 | 73 | org.locationtech.proj4j.geoapi.spi 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/GeographicCRSWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import org.opengis.referencing.crs.GeographicCRS; 19 | import org.opengis.referencing.cs.EllipsoidalCS; 20 | 21 | 22 | /** 23 | * Wraps a PROJ4J implementation behind the equivalent GeoAPI interface. 24 | * 25 | * @author Martin Desruisseaux (Geomatys) 26 | */ 27 | @SuppressWarnings("serial") 28 | final class GeographicCRSWrapper extends AbstractCRS implements EllipsoidalCS, GeographicCRS { 29 | /** 30 | * Creates a new wrapper for the given PROJ4J implementation. 31 | */ 32 | GeographicCRSWrapper(org.locationtech.proj4j.CoordinateReferenceSystem impl, boolean is3D) { 33 | super(impl, is3D); 34 | } 35 | 36 | /** 37 | * {@return the coordinate system, which is implemented by the same class for convenience}. 38 | */ 39 | @Override 40 | public EllipsoidalCS getCoordinateSystem() { 41 | clearAxisCache(); 42 | return this; 43 | } 44 | 45 | @Override 46 | final Axis[] axesForAllDirections() { 47 | return Axis.GEOGRAPHIC; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/IdentifierEPSG.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import java.util.Collections; 19 | import java.util.Set; 20 | import org.opengis.referencing.ReferenceIdentifier; 21 | 22 | 23 | /** 24 | * A simple EPSG identifier made of only a code and a code space. 25 | * 26 | * @author Martin Desruisseaux (Geomatys) 27 | */ 28 | final class IdentifierEPSG extends Wrapper { 29 | /** 30 | * The EPSG code. 31 | */ 32 | private final int code; 33 | 34 | /** 35 | * Creates a new identifier for the given EPSG code. 36 | */ 37 | private IdentifierEPSG(final int code) { 38 | this.code = code; 39 | } 40 | 41 | /** 42 | * Wraps the given EPSG code. 43 | * 44 | * @param code the EPSG code, or 0 if none 45 | * @return the wrapper, or an empty set if the given EPSG code was 0 46 | */ 47 | static Set wrap(final int code) { 48 | return (code != 0) ? Collections.singleton(new IdentifierEPSG(code)) : Collections.emptySet(); 49 | } 50 | 51 | /** 52 | * {@return the EPSG code}. 53 | */ 54 | @Override 55 | Object implementation() { 56 | return code; 57 | } 58 | 59 | /** 60 | * {@return the code space, which is fixed to "EPSG"}. 61 | */ 62 | @Override 63 | public String getCodeSpace() { 64 | return "EPSG"; 65 | } 66 | 67 | /** 68 | * {@return the string representation of the EPSG code}. 69 | */ 70 | @Override 71 | public String getCode() { 72 | return Integer.toString(code); 73 | } 74 | 75 | /** 76 | * {@return the string representation of this identifier}. 77 | */ 78 | @Override 79 | public String toString() { 80 | return getCodeSpace() + ':' + code; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/LocalizedString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import java.io.Serializable; 19 | import java.util.Locale; 20 | import org.opengis.util.InternationalString; 21 | 22 | 23 | /** 24 | * A string in a specific locale. 25 | * In the current version, the locale is unspecified. 26 | * 27 | * @author Martin Desruisseaux (Geomatys) 28 | */ 29 | @SuppressWarnings("serial") 30 | final class LocalizedString implements InternationalString, Serializable { 31 | /** 32 | * The "not known" value. ISO 19111 requires that we return this string 33 | * if the scope of a datum or coordinate operation is unknown. 34 | */ 35 | static final LocalizedString UNKNOWN = new LocalizedString("not known"); 36 | 37 | /** 38 | * The localized text. 39 | */ 40 | private final String text; 41 | 42 | /** 43 | * Creates a new international string. 44 | * 45 | * @param text the localized text 46 | */ 47 | private LocalizedString(final String text) { 48 | this.text = text; 49 | } 50 | 51 | /** 52 | * Returns the given text as an international string. 53 | * 54 | * @param text the localized text, or {@code null} 55 | * @return the international string, or {@code null} if the given text was null 56 | */ 57 | static LocalizedString wrap(final String text) { 58 | return (text != null) ? new LocalizedString(text) : null; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return text; 64 | } 65 | 66 | @Override 67 | public String toString(Locale locale) { 68 | return text; 69 | } 70 | 71 | @Override 72 | public int length() { 73 | return text.length(); 74 | } 75 | 76 | @Override 77 | public char charAt(int index) { 78 | return text.charAt(index); 79 | } 80 | 81 | @Override 82 | public CharSequence subSequence(int start, int end) { 83 | return text.subSequence(start, end); 84 | } 85 | 86 | @Override 87 | public int compareTo(InternationalString o) { 88 | return text.compareTo(o.toString()); 89 | } 90 | 91 | @Override 92 | public boolean equals(Object o) { 93 | return (o instanceof LocalizedString) && text.equals(((LocalizedString) o).text); 94 | } 95 | 96 | @Override 97 | public int hashCode() { 98 | return text.hashCode() ^ getClass().hashCode(); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/ProjectedCRSWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import org.locationtech.proj4j.BasicCoordinateTransform; 19 | import org.opengis.referencing.crs.GeographicCRS; 20 | import org.opengis.referencing.crs.ProjectedCRS; 21 | import org.opengis.referencing.cs.CartesianCS; 22 | import org.opengis.referencing.operation.Projection; 23 | 24 | 25 | /** 26 | * Wraps a PROJ4J implementation behind the equivalent GeoAPI interface. 27 | * 28 | * @author Martin Desruisseaux (Geomatys) 29 | */ 30 | @SuppressWarnings("serial") 31 | final class ProjectedCRSWrapper extends AbstractCRS implements CartesianCS, ProjectedCRS { 32 | /** 33 | * The conversion from the base CRS, created when first requested. 34 | */ 35 | private transient Projection conversionFromBase; 36 | 37 | /** 38 | * Creates a new wrapper for the given PROJ4J implementation. 39 | */ 40 | ProjectedCRSWrapper(org.locationtech.proj4j.CoordinateReferenceSystem impl, boolean is3D) { 41 | super(impl, is3D); 42 | } 43 | 44 | /** 45 | * {@return the coordinate system, which is implemented by the same class for convenience}. 46 | */ 47 | @Override 48 | public CartesianCS getCoordinateSystem() { 49 | clearAxisCache(); 50 | return this; 51 | } 52 | 53 | @Override 54 | final Axis[] axesForAllDirections() { 55 | return Axis.PROJECTED; 56 | } 57 | 58 | /** 59 | * {@return the base CRS of this projected CRS}. 60 | */ 61 | @Override 62 | public GeographicCRS getBaseCRS() { 63 | return (GeographicCRS) getConversionFromBase().getSourceCRS(); 64 | } 65 | 66 | /** 67 | * {@return the conversion from the base CRS to this projected CRS}. 68 | */ 69 | @Override 70 | public synchronized Projection getConversionFromBase() { 71 | if (conversionFromBase == null) { 72 | BasicCoordinateTransform tr = new BasicCoordinateTransform(impl.createGeographic(), impl); 73 | conversionFromBase = is3D ? new ProjectionWrapper3D(tr) : new ProjectionWrapper2D(tr); 74 | } 75 | return conversionFromBase; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/ProjectionWrapper2D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import org.locationtech.proj4j.CoordinateTransform; 19 | import org.opengis.parameter.ParameterValueGroup; 20 | import org.opengis.referencing.operation.OperationMethod; 21 | 22 | 23 | /** 24 | * Wraps a PROJ4J transform behind the equivalent GeoAPI interface for the two-dimensional case of a map projection. 25 | * The source CRS must be geographic and the target CRS must be projected. 26 | * 27 | * @author Martin Desruisseaux (Geomatys) 28 | */ 29 | @SuppressWarnings("serial") 30 | final class ProjectionWrapper2D extends TransformWrapper2D implements org.opengis.referencing.operation.Projection { 31 | /** 32 | * Creates a new wrapper for the given PROJ4J implementation. 33 | */ 34 | ProjectionWrapper2D(final CoordinateTransform impl) { 35 | super(impl); 36 | } 37 | 38 | /** 39 | * {@return a description of the map projection}. 40 | */ 41 | @Override 42 | public OperationMethod getMethod() { 43 | return OperationMethodWrapper.wrapTarget(impl); 44 | } 45 | 46 | /** 47 | * {@return the parameters of the map projection}. 48 | * In this implementation, this is provided by the same class as the description. 49 | */ 50 | @Override 51 | public ParameterValueGroup getParameterValues() { 52 | return OperationMethodWrapper.wrapTarget(impl); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/ProjectionWrapper3D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import org.locationtech.proj4j.CoordinateTransform; 19 | import org.opengis.parameter.ParameterValueGroup; 20 | import org.opengis.referencing.operation.OperationMethod; 21 | 22 | 23 | /** 24 | * Wraps a PROJ4J transform behind the equivalent GeoAPI interface for the three-dimensional case of a map projection. 25 | * The source CRS must be geographic and the target CRS must be projected. 26 | * 27 | * @author Martin Desruisseaux (Geomatys) 28 | */ 29 | @SuppressWarnings("serial") 30 | final class ProjectionWrapper3D extends TransformWrapper3D implements org.opengis.referencing.operation.Projection { 31 | /** 32 | * Creates a new wrapper for the given PROJ4J implementation. 33 | */ 34 | ProjectionWrapper3D(final CoordinateTransform impl) { 35 | super(impl); 36 | } 37 | 38 | /** 39 | * {@return a description of the map projection}. 40 | */ 41 | @Override 42 | public OperationMethod getMethod() { 43 | return OperationMethodWrapper.wrapTarget(impl); 44 | } 45 | 46 | /** 47 | * {@return the parameters of the map projection}. 48 | * In this implementation, this is provided by the same class as the description. 49 | */ 50 | @Override 51 | public ParameterValueGroup getParameterValues() { 52 | return OperationMethodWrapper.wrapTarget(impl); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/UnconvertibleInstanceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import org.locationtech.proj4j.Proj4jException; 19 | 20 | 21 | /** 22 | * Thrown by {@code Wrapper.proj4j(…)} when a GeoAPI object cannot be unwrapped or copied to a PROJ4J implementation. 23 | * This exception is never thrown when the given GeoAPI object has been created by a {@code Wrapper.geoapi(…)} method. 24 | * This exception may be thrown for GeoAPI objects created by other libraries, depending on the characteristics of the 25 | * object. For example, it may depend on whether the coordinate system uses unsupported axis directions. 26 | * 27 | * @author Martin Desruisseaux (Geomatys) 28 | */ 29 | @SuppressWarnings("serial") 30 | public class UnconvertibleInstanceException extends Proj4jException { 31 | /** 32 | * Creates a new exception with no message. 33 | */ 34 | public UnconvertibleInstanceException() { 35 | } 36 | 37 | /** 38 | * Creates a new exception with the given message. 39 | * 40 | * @param message the exception message, or {@code null} 41 | */ 42 | public UnconvertibleInstanceException(String message) { 43 | super(message); 44 | } 45 | 46 | /** 47 | * Creates a new exception with a message built for the given object name and type. 48 | * 49 | * @param name the name of the object that cannot be unwrapped 50 | * @param type the type of the object that cannot be unwrapped 51 | */ 52 | UnconvertibleInstanceException(String name, String type) { 53 | super("Cannot unwrap the \"" + name + "\" " + type + " as a PROJ4J implementation."); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Wraps the PROJ4J classes behind the equivalent GeoAPI interfaces. 19 | * This module provides a public class, {@link org.locationtech.proj4j.geoapi.Wrappers}, 20 | * with overloaded {@code geoapi(…)} methods. Those methods expected a PROJ4J object in 21 | * argument and returns a view of that object as a GeoAPI type. 22 | * 23 | *

Dependency to a Unit of Measurement library

24 | * This module requires a JSR-385 (Units of Measurement) implementation 25 | * to be present on the class-path or module-path. 26 | * The choice of an implementation is left to the user. Some implementations are 27 | * Indriya, 28 | * Seshat and 29 | * Apache SIS. 30 | * The two latter support EPSG codes for units of measurement. 31 | * 32 | *

Mutability

33 | * No information is copied. All methods of the views delegate their work to the PROJ4J implementation. 34 | * Consequently, since PROJ4J objects are mutable, changes to the wrapped PROJ4J object are immediately 35 | * reflected in the view. However, it is not recommended to change a wrapped PROJ4J object as CRS should 36 | * be immutable. 37 | * 38 | *

There is one exception to the above paragraph: whether an object is a geographic or projected CRS. 39 | * Because the type of a Java object cannot change dynamically, whether a CRS is geographic or projected 40 | * is determined at {@code geoapi(CoordinateReferenceSystem)} invocation time.

41 | * 42 | *

Serialization

43 | * The serialization details are not committed API. 44 | * Serialization is okay for exchanging objects between JVM running the same version of PROJ4J, 45 | * but is not guaranteed to be compatible between different versions of PROJ4J. This module does not define 46 | * {@code serialVersionUID} because the backing PROJ4J objects do not define those UID anyway. 47 | * 48 | * @author Martin Desruisseaux (Geomatys) 49 | */ 50 | package org.locationtech.proj4j.geoapi; 51 | -------------------------------------------------------------------------------- /geoapi/src/main/java/org/locationtech/proj4j/geoapi/spi/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Registration of PROJ4J wrappers as referencing services. 19 | * Developers should not use this package directly, as it may change in any future version. 20 | * In particular, it may be simplified if PROJ4J migrates to Java 9+ module system. 21 | * 22 | * @author Martin Desruisseaux (Geomatys) 23 | */ 24 | package org.locationtech.proj4j.geoapi.spi; 25 | -------------------------------------------------------------------------------- /geoapi/src/main/resources/META-INF/services/org.opengis.referencing.crs.CRSAuthorityFactory: -------------------------------------------------------------------------------- 1 | org.locationtech.proj4j.geoapi.spi.AuthorityFactory 2 | -------------------------------------------------------------------------------- /geoapi/src/main/resources/META-INF/services/org.opengis.referencing.operation.CoordinateOperationFactory: -------------------------------------------------------------------------------- 1 | org.locationtech.proj4j.geoapi.spi.OperationFactory 2 | -------------------------------------------------------------------------------- /geoapi/src/test/java/org/locationtech/proj4j/geoapi/ServicesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import java.util.Iterator; 19 | import java.util.ServiceLoader; 20 | import org.junit.Test; 21 | import org.opengis.referencing.crs.CRSAuthorityFactory; 22 | import org.opengis.referencing.crs.CoordinateReferenceSystem; 23 | import org.opengis.referencing.operation.CoordinateOperationFactory; 24 | import org.opengis.util.FactoryException; 25 | 26 | import static org.locationtech.proj4j.CoordinateReferenceSystem.CS_GEO; 27 | import static org.junit.Assert.*; 28 | 29 | 30 | /** 31 | * Tests fetching factory instances as services. 32 | * 33 | * @author Martin Desruisseaux (Geomatys) 34 | */ 35 | public class ServicesTest { 36 | /** 37 | * Creates a new test case. 38 | */ 39 | public ServicesTest() { 40 | } 41 | 42 | /** 43 | * Returns the factory of the given type, making sure that there is exactly one instance. 44 | */ 45 | private static F getSingleton(final Class service) { 46 | Iterator it = ServiceLoader.load(service).iterator(); 47 | assertTrue(it.hasNext()); 48 | F factory = it.next(); 49 | assertFalse(it.hasNext()); 50 | return factory; 51 | } 52 | 53 | /** 54 | * Tests the CRS authority factory. 55 | * This method only checks that the object are non-null. 56 | * More detailed checks are performed by {@link WrappersTest}. 57 | * 58 | * @throws FactoryException if an error occurred while creating an object. 59 | */ 60 | @Test 61 | public void testAuthorityFactory() throws FactoryException { 62 | final CRSAuthorityFactory factory = getSingleton(CRSAuthorityFactory.class); 63 | assertNotNull(factory.createGeographicCRS("EPSG:4326")); 64 | assertNotNull(factory.createProjectedCRS ("EPSG:2154")); 65 | } 66 | 67 | /** 68 | * Tests the operation authority factory. 69 | * This method only checks that the object are non-null. 70 | * 71 | * @throws FactoryException if an error occurred while creating an object. 72 | */ 73 | @Test 74 | public void testOperationFactory() throws FactoryException { 75 | final CoordinateOperationFactory factory = getSingleton(CoordinateOperationFactory.class); 76 | final CoordinateReferenceSystem crs = Wrappers.geoapi(CS_GEO, false); 77 | assertTrue(factory.createOperation(crs, crs).getMathTransform().isIdentity()); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /geoapi/src/test/java/org/locationtech/proj4j/geoapi/TransformTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025, PROJ4J contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.locationtech.proj4j.geoapi; 17 | 18 | import org.junit.Test; 19 | import org.opengis.referencing.operation.MathTransform; 20 | import org.opengis.referencing.operation.TransformException; 21 | import org.opengis.test.referencing.TransformTestCase; 22 | import org.opengis.util.FactoryException; 23 | 24 | 25 | /** 26 | * Tests some coordinate operations. 27 | * 28 | * @author Martin Desruisseaux (Geomatys) 29 | */ 30 | public class TransformTest extends TransformTestCase { 31 | /** 32 | * Creates a new test case. 33 | */ 34 | public TransformTest() { 35 | } 36 | 37 | /** 38 | * Creates a transform between the given pair of coordinate reference systems. 39 | * 40 | * @param source authority code of the input coordinate reference system 41 | * @param target authority code of the output coordinate reference system 42 | * @return a coordinate operation from {@code source} to {@code target} 43 | * @throws FactoryException if the coordinate operation cannot be created 44 | */ 45 | private static MathTransform transform(String source, String target) throws FactoryException { 46 | return Services.findOperation(Services.createCRS(source), Services.createCRS(target)).getMathTransform(); 47 | } 48 | 49 | /** 50 | * Tests a projection from a geographic CRS to a projected CRS. 51 | * 52 | * @throws FactoryException if a CRS cannot be created 53 | * @throws TransformException if an error occurred while testing the projection of a point 54 | */ 55 | @Test 56 | public void testProjection() throws FactoryException, TransformException { 57 | transform = transform("EPSG:4326", "EPSG:2154"); 58 | tolerance = 1E-3; 59 | verifyTransform(new double[] {3, 46.5}, // Coordinates to test (more can be added on this line). 60 | new double[] {700000, 6600000}); // Expected result. 61 | 62 | // Random coordinates. 63 | final float[] coordinates = { 64 | 3.0f, 46.5f, 65 | 2.5f, 43.0f, 66 | 3.5f, 46.0f, 67 | 4.5f, 48.0f, 68 | 1.5f, 41.0f, 69 | 3.8f, 43.7f, 70 | 3.1f, 42.1f, 71 | }; 72 | verifyConsistency(coordinates); 73 | verifyInverse(coordinates); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /locationtech_mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/locationtech/proj4j/c856914930fc5b620ac4853784a5d6c733ae0d40/locationtech_mark.png --------------------------------------------------------------------------------