Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for polar stereographic with alternate scales #106

Open
gwlucastrig opened this issue Dec 8, 2023 · 4 comments
Open

Support for polar stereographic with alternate scales #106

gwlucastrig opened this issue Dec 8, 2023 · 4 comments

Comments

@gwlucastrig
Copy link

I wasn't able to find user-discussions on the web, so I am posting this question as an issue.

I wish to access a data set built on the polar stereographic with scale set to be true at 75 north. Although it looks like the StereographicAzimuthalProjection class has support (undocumented) for the Universal Polar Stereographic projection (UPS). The UPS has a true scale at about 81.11 N, so it doesn't quite fit my requirements. I suppose I could do a hack, but I was wondering if there was a better way to proceed.

@pomadchin
Copy link
Member

Hi @gwlucastrig, I'd be happy to help you with whatever approach. Making a PR could be a good starting point, if you have a need why not to try to get it fixed!

@gwlucastrig
Copy link
Author

Thanks. I'll take a look at the math and see how it fits within the existing code framework. I would want to make sure I could do something consistent with what you've already got. If I can do that, I'll submit a PR.

@gwlucastrig
Copy link
Author

I found the solution, no code changes required. The StereographicAzimuthalProjection has methods called setTrueScaleLatitude() and setTrueScaleLatitudeDegrees() that can be used to set the latitude at which the map scale will be true (1.0). Since the latitude at which I needed for the scale to be true was 75 degrees north, I used the following:

    Datum datum = Datum.WGS84;
    Ellipsoid ellipsoid = datum.getEllipsoid();
    StereographicAzimuthalProjection p = new StereographicAzimuthalProjection(Math.PI / 2, 0);
    p.setEllipsoid(ellipsoid);
    p.setTrueScaleLatitudeDegrees(75.0);
    p.initialize();

This does have the effect of making calls to initialize multiple times (it's called inside the constructor and by the application code), but it gets the job done. Incidentally, the latitude of true scale for Universal Polar Stereographic is approximately 81.11451786859362545 (Wikipedia). So I tested this approach by modifying my program to take that as the argument for setTrueScaleLatitudeDegrees() and comparing it to the results I got when using the setupUps() method provided by the projection class.

Unless you want additional information, I intend to close this issue.

@gwlucastrig
Copy link
Author

Incidentally, I notice that in Registry.java, there is an entry for Universal Transverse Mercator (UTM), but the one for Universal Polar Stereographic (UPS) is a commented-out placeholder. It would be straightforward to write a class for UPS derived from StereographicAzimuthalProjection with the appropriate constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants