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

Implement Web Mercator #67

Merged
merged 2 commits into from Mar 22, 2021
Merged

Implement Web Mercator #67

merged 2 commits into from Mar 22, 2021

Conversation

c42f
Copy link
Member

@c42f c42f commented Feb 10, 2021

See https://discourse.julialang.org/t/converting-longitude-latitude-to-x-y-on-a-map-using-julia/20611/13

The names WebMercatorfromLLA and LLAfromWebMercator seem a bit unfortunate, but the lowercase from is consistent with the rest of the transformations in this package, and WebMercator doesn't seem to have an obvious shortening. (There's WebMerc maybe, but unclear whether that's helpful.) There's also LatLon support here, but again I used LLA for consistency in naming even though it's a bit ugly.

end

function (trans::WebMercatorfromLLA)(ll::LatLon)
lat_lim = 85.6 # according to https://epsg.io/3857

Choose a reason for hiding this comment

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

I think it's 85.06 or more exactly

const MAX_LAT = rad2deg(2*atan(ℯ^pi)-pi/2)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes this was a typo - thanks!

We could use rad2deg(2*atan(ℯ^pi)-pi/2), that's easy enough. (This is the value which makes the bounding box in northing and easting square, right?)

However I wondered whether the more permissive 85.06 was an intentional choice chosen by the standards body, in order to

  • Use a rational rather than irrational number
  • Allow some leeway for computing with geometries which have been clipped to the extent of the projection, but are slightly over after numerical error.

@c42f c42f merged commit bd12357 into master Mar 22, 2021
@c42f c42f deleted the cjf/webmercator branch March 22, 2021 23:57
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

3 participants