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

Get the central longitude from any transformation / projection #306

Closed
asinghvi17 opened this issue Jan 16, 2025 · 1 comment
Closed

Get the central longitude from any transformation / projection #306

asinghvi17 opened this issue Jan 16, 2025 · 1 comment

Comments

@asinghvi17
Copy link
Member

asinghvi17 commented Jan 16, 2025

It's possible to do this arbitrarily by using Proj:

PJ *proj_get_prime_meridian(PJ_CONTEXT *ctx, const PJ *obj)
Get the prime meridian of a CRS or a GeodeticReferenceFrame.

The returned object must be unreferenced with proj_destroy() after use. It should be used by at most one thread at a time.

Parameters
:
ctx -- PROJ context, or NULL for default context

obj -- Object of type CRS or GeodeticReferenceFrame (must not be NULL)

Returns
:
Object that must be unreferenced with proj_destroy(), or NULL in case of error.

int proj_prime_meridian_get_parameters(PJ_CONTEXT *ctx, const PJ *prime_meridian, double *out_longitude, double *out_unit_conv_factor, const char **out_unit_name)
Return prime meridian parameters.

Parameters
:
ctx -- PROJ context, or NULL for default context

prime_meridian -- Object of type PrimeMeridian (must not be NULL)

out_longitude -- Pointer to a value to store the longitude of the prime meridian, in its native unit. or NULL

out_unit_conv_factor -- Pointer to a value to store the conversion factor of the prime meridian longitude unit to radian. or NULL

out_unit_name -- Pointer to a string value to store the unit name. or NULL

Returns
:
TRUE in case of success.

@asinghvi17
Copy link
Member Author

Unfortunately this does not seem to return the lon_0 but rather the PRIMEM as defined in WKT, so it's a non starter. Maybe we need to emit the Proj string of the target CRS, and parse that...but then we'd also need to check the source CRS!

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

No branches or pull requests

1 participant