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

custom projections, fixed sys.Lam0 and sys.Phi0 #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

linotypical
Copy link

Added CustomProjection() to Convert.go to allow custom projection strings to be loaded in without having to modify the package.

More importantly, while trying to use this package with EPSG3005, which uses the Albers Equal Area projection, it was discovered that numerous problems with that projection were being caused by sys.Lam0 and sys.Phi0 being in degrees, whereas anywhere those values are referenced in the code, they are referenced as radians.

Also changed default value of sys.FromMeter to 1.0, as the go zero value of 0.0 was causing divide by 0 errors when units were specified in the proj string.

…i0 to be in radians, as the code appears to expect, not degrees.
// CustomProjection provides write-only access to the internal projection list
// so that projections may be added without having to modify the library code.
func CustomProjection(code EPSGCode, str string) {
projStrings[code] = str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I few ideas on this method:

  • Implement a mutex since you're modifying a map
  • Perform a check that the code is not already registered. I'm not sure if this should overwrite a code that already exists.

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

Successfully merging this pull request may close these issues.

None yet

2 participants