Code Monkey home page Code Monkey logo

Comments (3)

pomadchin avatar pomadchin commented on July 22, 2024

Hello, thanks for reporting! Could you prepare the failing test case? I.e. the code that generates a wrong result + what should be the expected result.

from proj4j.

jidengke avatar jidengke commented on July 22, 2024

Thank you for your reply
code

import org.locationtech.proj4j.*;

/**
 * Proj4jTest
 *
 * @author jidengke
 * @date 2021/3/7 13:24
 */
public class Proj4jTest {
    public static void main(String[] args) {
        ProjCoordinate s=new ProjCoordinate();
        s.y=-4.504755;
        s.x=65.324837;
        String wgsParam="+proj=longlat +datum=WGS84 +no_defs";
        String lccParam="+proj=lcc +lat_1=20.0 +lat_2=50.0 +lat_0=38.00001 +lon_0=102.0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +R=6370000 +no_defs";;
        CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
        CRSFactory csFactory = new CRSFactory();
        CoordinateReferenceSystem source = csFactory.createFromParameters("wgs", wgsParam);
        CoordinateReferenceSystem target = csFactory.createFromParameters("lcc", lccParam);
        CoordinateTransform coordinateTransform = ctFactory.createTransform(source, target);
        ProjCoordinate t = new ProjCoordinate();
        coordinateTransform.transform(s, t);
        System.out.println(t.x);
        System.out.println(t.y);
    }
}

Program output
x=-4813708.6575989155
y=-3981769.0948999394

this is qgis output
x=-4819499.5840
y=-4009501.2945

1615096378(1)

from proj4j.

jidengke avatar jidengke commented on July 22, 2024

I tried to add a new datum to the source code
1615097481(1)

String lccParam="+proj=lcc +lat_1=20.0 +lat_2=50.0 +lat_0=38.00001 +lon_0=102.0 +x_0=0 +y_0=0 +ellps=CLEAR +units=m +no_defs";

this output

x=-4819499.583995361
y=-4009501.2944552563

from proj4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.