Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7947769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:31:40+00:00 2026-06-04T01:31:40+00:00

I have to transform GPS coordinates (latitude and longitude) to a Lambert Conformal Conic

  • 0

I have to transform GPS coordinates (latitude and longitude) to a Lambert Conformal Conic projection. The map refers to Italy.
Since I’m not an expert of this subject I found (googling) that one of the best libraries for Java is GeoToolkit. Unfortunately, I found no examples nor documentation (only Javadoc).
Here the projection parameters (proj=Lcc Lat_2=45 Lat_1=40 Lat_0=42.5 Lon_0=9.2 x_0=600000 y_0=2200000):

PARAM_MT["Lambert_Conformal_Conic_2SP", 
PARAMETER["semi_major", 6378137.0], 
PARAMETER["semi_minor", 6356752.314], 
PARAMETER["central_meridian", 9.2], 
PARAMETER["latitude_of_origin", 42.5], 
PARAMETER["false_easting", 600000.0], 
PARAMETER["false_northing", 2200000.0], 
PARAMETER["standard_parallel_2", 45.0], 
PARAMETER["standard_parallel_1", 40.0]]

Does anyone knows a better library than GeoToolkit?

I wrote the following code to convert coords:

// 1. Get the MathTransform Factory
MathTransformFactory factory;

FactoryRegistry registry = new FactoryRegistry(
        MathTransformFactory.class);

factory = registry.getServiceProvider(MathTransformFactory.class, null,
        null, Hints.MATH_TRANSFORM_FACTORY);

// 2. Define source and target coord reference systems
GeographicCRS sourceCRS = DefaultGeographicCRS.WGS84;

ParameterValueGroup parameters = factory
        .getDefaultParameters("Lambert_Conformal_Conic_2SP");
parameters.parameter("semi_major").setValue(WGS84_AXIS_MAJOR);
parameters.parameter("semi_minor").setValue(WGS84_AXIS_MINOR);
parameters.parameter("central_meridian").setValue(9.2);
parameters.parameter("latitude_of_origin").setValue(42.5);
parameters.parameter("standard_parallel_1").setValue(40.0);
parameters.parameter("standard_parallel_2").setValue(45.0);
parameters.parameter("false_easting").setValue(600000);
parameters.parameter("false_northing").setValue(2200000);

// 3. Create the MathTransform with the given parameters
Conversion conversion = new DefiningConversion("GPS to Lambert",
        parameters);

CRSFactory crsFactory = FactoryFinder.getCRSFactory(null);
Map<String, ?> properties = Collections.singletonMap(
        ProjectedCRS.NAME_KEY, "LatLon2Lambert");
ProjectedCRS targetCRS = crsFactory.createProjectedCRS(properties,
        sourceCRS, conversion, DefaultCartesianCS.GENERIC_2D);

MathTransform tr = CRS.findMathTransform(sourceCRS, targetCRS);

DirectPosition sourcePt = new DefaultDirectPosition(DefaultGeographicCRS.WGS84);
sourcePt.setOrdinate(0, 45.0);
sourcePt.setOrdinate(1, 8.0);

DirectPosition targetPt = tr.transform(p.getValue(), null);

However, it doesn’t work.
Where am I wrong?
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:31:41+00:00Added an answer on June 4, 2026 at 1:31 am

    The presented code is correct.
    The only problem is the input: GeoToolkit use a positional notation to identify latitude and longitude. And it requires that the first parameter is longitude.
    For example, at the end of the above code, you can perform the transformation.

    The following is an example:

    DirectPosition sourcePt = new GeneralDirectPosition(DefaultGeographicCRS.WGS84);
    sourcePt.setOrdinate(0, Double.parseDouble(8.751426)); // longitude
    sourcePt.setOrdinate(1, Double.parseDouble(45.12478)); // latitude
    
    DirectPosition targetPt = tr.transform(p.getValue(), null);
    

    In the targetPt variable you have the correct coordinates in Lambert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think we cannot have any bending transform in iOS, not even with 3D
I wonder if anyone has an idea how you have to transform an image
I have an XSLT transform issue: style=width:{Data/PercentSpaceUsed}%; And the value of Data/PercentSpaceUsed is integer
we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT
I have a string of style transform given in the following way : matrix(0.312321,
I have a task to import/transform and extract zipped binary files that contain both
I have a generated JSON file that I would like to transform. Is there
I have a series of divs that slide down using -webkit-transform from a negative
I'm trying to have a script automatically transform an xml file into several html
I have a datetime column in db that I want to transform into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.