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

scattermapbox: Latitude and Longitude are displayed in the incorrect order #5472

Closed
MediumBrownToast opened this issue Feb 5, 2021 · 13 comments

Comments

@MediumBrownToast
Copy link

Example: Any of the examples in the Plotly documentation (this is NOT a documentation issue, it's just easy to use them as examples): https://plotly.com/javascript/scattermapbox/

Reproduce problem: Hover your mouse over any of the points in the map, the longitude and latitude are displayed.

Problem: The longitude and latitude are displayed in the wrong order. They should be displayed Latitude first, Longitude second.

"ISO 6709 - Standard representation of geographic point location by coordinates"

Latitude comes before longitude
North latitude is positive
East longitude is positive

https://en.wikipedia.org/wiki/ISO_6709#Order,_sign,_and_units
http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=53539

Proposed solution:
Add a new configuration key to select a display format. e.g. {"iso6709": "true"}
and/or
Swap the lat/long order displayed by default to conform with ISO6709

Thanks

@nicolaskruchten
Copy link
Contributor

Seems clear enough, thanks for the clear and well-supported issue! @archmoj @alexcjohnson since we're doing 2.0 anyway, let's just change the default here.

@archmoj archmoj added this to the NEXT milestone Feb 5, 2021
@archmoj
Copy link
Contributor

archmoj commented Feb 5, 2021

cc: #5395

@alexcjohnson
Copy link
Collaborator

Makes sense to me - we probably just copied over the (x, y) convention from 2D cartesian but maps do seem consistent in putting lat first. In fact, why don't we do away with the signs and use cardinal directions - that seems like the clearest of all. So instead of:

(-73.57º, 45.5º)

we would have:

45.5ºN 73.57ºW

I notice that the Representation_at_the_human_interface section (along with preferring cardinals) suggests sexagesimal (degrees, minutes, seconds) is preferred. But for our purposes I think decimal is better, if for no other reason than the source data is in decimal and it's important to be able to look at a data point and go back and find it in the source.

We may have a challenge extending N/S/E/W to hovertemplate, where numbers are formatted by the d3 mini-language eg Latitude: {lat:.3f} - this has no option to display the number unsigned and certainly doesn't know about the degree symbol or cardinal directions, so we may need four new fields, something like latunsigned, latcardinal, lonunsigned, loncardinal. Then if you wanted to recreate the default as part of a template, it would look like {latunsigned:.3f}º{latcardinal} {lonunsigned:.3f}º{loncardinal}

@alexcjohnson
Copy link
Collaborator

Note this applies to both mapbox and geo subplots

@nicolaskruchten
Copy link
Contributor

I agree that cardinal directions would be better, but for now let's just switch the order in the default hoverlabel. I'm fine with tweaking the actual formatting later :)

@alexcjohnson
Copy link
Collaborator

Sounds good, let's just leave this issue open (perhaps with an updated title) until we add cardinal directions.

@MediumBrownToast
Copy link
Author

Thank you very much for the prompt and positive responses! (and apologies if this is a bad use of comment)

@archmoj archmoj modified the milestone: NEXT Feb 11, 2021
@MediumBrownToast
Copy link
Author

Apologies in advance, I'm not a GitHub expert so I might be confused. Should I be seeing this change in the 2.0.0-RC1? From what I can see #5485 was merged into the master branch. I'm using the https://cdn.plot.ly/plotly-mapbox-2.0.0-rc.1.min.js as the source in the page I'm creating. Thanks.

@archmoj
Copy link
Contributor

archmoj commented May 18, 2021

Apologies in advance, I'm not a GitHub expert so I might be confused. Should I be seeing this change in the 2.0.0-RC1? From what I can see #5485 was merged into the master branch. I'm using the https://cdn.plot.ly/plotly-mapbox-2.0.0-rc.1.min.js as the source in the page I'm creating. Thanks.

Yes. It is included in v2.0.0-rc.1.

@MediumBrownToast
Copy link
Author

Yes. It is included in v2.0.0-rc.1.

Ahh, ok I understand now. Your change was made to the scattergeo source which is why I didn't see the change in the scattermapbox I was using. My bad.

@nicolaskruchten
Copy link
Contributor

@archmoj did we implement this only for geo and not mapbox?

@archmoj
Copy link
Contributor

archmoj commented May 21, 2021

@archmoj did we implement this only for geo and not mapbox?

Good catch. It will be fixed by #5676.

@MediumBrownToast
Copy link
Author

Thank you, @archmoj and everyone else!

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

4 participants