Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4.2k
Add latitude & longitude mercator support#14656
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:branch-3.9
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
codecovbot commentedOct 1, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@## branch-3.9 #14656 +/- ##============================================= Coverage ? 91.82% ============================================= Files ? 288 Lines ? 20786 Branches ? 0 ============================================= Hits ? 19086 Misses ? 1700 Partials ? 0 🚀 New features to boost your workflow:
|
| case"mercator_lon": | ||
| returnnewLinearScale() | ||
| case"mercator_lat": | ||
| returnnewMercatorLatitudeScale() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Offhand this seems backwards to me? latitudes are always evenly spaced apart, but the distance between longitude lines varies depending on latitude. I would expect a linear scale to work for latitude butnot to work for longitude. I haven't thought about this in some years though, maybe you can walk me through it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What you are describing is true for a sphere/ellipsoid, however the map will be shown in 2D using the web mercator projection (this is where the scales matter). In the web mercator projection the distance between longitude is independent of the latitude which allows for 2D view in the first place. Of course in other to "keep" the proportion the latitude will not behave linearly.
| constlat_proj_y=lat_proj_end-lat_proj_range*(sy-y0)/height | ||
| const[,lat]=wgs84_mercator.invert(0,lat_proj_y) | ||
| returnlat | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The dimension switching here is just in case someone wants to put latitudes on the x axis? I actually think we might be better off finding some way to make that impossible at the API level. i.e. non-sensical things should not be easy to spell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yes more or less this is just for completeness here. I'm totally okay with outputting a warning in this case as I cannot think about scenario where this is needed.
I agree that this should be caught on a higher level.
bryevdv commentedOct 1, 2025
I left a few initial comments. I am not sure I thrilled about making users explicitly coordinate It seem like it would be super easy for users to supply these backwards. I had always previously envisioned this as an input and formatting issue... i.e. we'd keep the existing mercator machinery always working in terms of meters (northings and eastings) but make it so that "lat/lon" inputs were understood and would set an (overrideable) config automatically. |
muendlein commentedOct 1, 2025
I agree that this is certainly not a good solution. However I'm not sure about other good options that help with knowing what data to expect. Do you think about this config as an additional keyword argument of the figure class describing the data coordinate system? |
bryevdv commentedOct 7, 2025
ping@philippjfr@jbednar etc for geoviews thoughs. |
ahuang11 commentedOct 7, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'd love to see this natively supported in Bokeh! Wondering the reason behind naming it Dumb question, but does this allow mixing mercator tiles with lon/lat data? i.e. would I be able to get away with using lon/lat data in this without ll2en (lon_lat_to_easting_northing) called? I suspect not?
Oh I see. I think this is still useful. |
muendlein commentedOct 8, 2025
There is no strong reason behind this. Based on the previous comment the API is still undecided anyway.
@ahuang11 My wording was probably not precise here. With "the data" I was basically referring to any data except for tile data as the latter is handled internally anyway. Therefore this PR indeed targets to support both tiles as well as "external" coordinate data. The idea is to get rid of the upfront data conversions. |
Uh oh!
There was an error while loading.Please reload this page.
Usage:
p = figure(x_range=(-30, 30), y_range=(-40, 40), x_axis_type="mercator_lon", y_axis_type="mercator_lat")