[COMPASS-5526] Latitude and longitude are reversed on the map in the Schema tab. Created: 20/Feb/22  Updated: 29/Oct/23  Resolved: 22/Feb/22

Status: Closed
Project: Compass
Component/s: Schema
Affects Version/s: None
Fix Version/s: 1.31.0

Type: Bug Priority: Minor - P4
Reporter: Maksim Simonenko Assignee: Anna Henningsen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 20.04 LTS
Compass 1.30.1


Attachments: PNG File Screenshot from 2022-02-21 17-54-35.png     PNG File Screenshot from 2022-02-21 17-55-05.png     PNG File image-2022-02-20-18-59-15-360.png     PNG File image-2022-02-21-16-26-01-864.png     PNG File image-2022-02-21-16-29-30-212.png     PNG File image-2022-02-21-16-30-44-022.png     PNG File image-2022-02-21-16-31-49-987.png    
Story Points: 1
Documentation Changes: Not Needed
Sprint: Iteration Versailles

 Description   

Problem Statement/Rationale

What is going wrong? What action would you like the Engineering team to take?

Steps to Reproduce

How could an engineer replicate the issue you’re reporting?

Expected Results

What do you expect to happen?

Actual Results

What do you observe is happening?

Additional Notes

Any additional information that may be useful to include.



 Comments   
Comment by Githook User [ 25/Feb/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(compass-schema): unambiguously display lat/long on map COMPASS-5526 (#2818)

GeoJSON (and thus MongoDB) stores coordinates as [Longitude, Latitude],
while elsewhere the reverse format [Latitude, Longitude] is common.

Compass displays the points on the map correctly, but reverses
the two values in the mouseover text.

Instead of switching to MongoDB/GeoJSON order, just clearly mark which
value is latitude and which is longitude.
Branch: 1.31-releases
https://github.com/mongodb-js/compass/commit/edd623f8fc333e2ee991b4daa10c5ce5ae680313

Comment by Githook User [ 23/Feb/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(compass-schema): unambiguously display lat/long on map COMPASS-5526 (#2818)

GeoJSON (and thus MongoDB) stores coordinates as [Longitude, Latitude],
while elsewhere the reverse format [Latitude, Longitude] is common.

Compass displays the points on the map correctly, but reverses
the two values in the mouseover text.

Instead of switching to MongoDB/GeoJSON order, just clearly mark which
value is latitude and which is longitude.
Branch: COMPASS-5506-update-item
https://github.com/mongodb-js/compass/commit/edd623f8fc333e2ee991b4daa10c5ce5ae680313

Comment by Githook User [ 22/Feb/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(compass-schema): unambiguously display lat/long on map COMPASS-5526 (#2818)

GeoJSON (and thus MongoDB) stores coordinates as [Longitude, Latitude],
while elsewhere the reverse format [Latitude, Longitude] is common.

Compass displays the points on the map correctly, but reverses
the two values in the mouseover text.

Instead of switching to MongoDB/GeoJSON order, just clearly mark which
value is latitude and which is longitude.
Branch: COMPASS-5511-make-connection-form-a-form
https://github.com/mongodb-js/compass/commit/edd623f8fc333e2ee991b4daa10c5ce5ae680313

Comment by Githook User [ 22/Feb/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(compass-schema): unambiguously display lat/long on map COMPASS-5526 (#2818)

GeoJSON (and thus MongoDB) stores coordinates as [Longitude, Latitude],
while elsewhere the reverse format [Latitude, Longitude] is common.

Compass displays the points on the map correctly, but reverses
the two values in the mouseover text.

Instead of switching to MongoDB/GeoJSON order, just clearly mark which
value is latitude and which is longitude.
Branch: move-query-history-to-left-of-query-bar
https://github.com/mongodb-js/compass/commit/edd623f8fc333e2ee991b4daa10c5ce5ae680313

Comment by Githook User [ 22/Feb/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(compass-schema): unambiguously display lat/long on map COMPASS-5526 (#2818)

GeoJSON (and thus MongoDB) stores coordinates as [Longitude, Latitude],
while elsewhere the reverse format [Latitude, Longitude] is common.

Compass displays the points on the map correctly, but reverses
the two values in the mouseover text.

Instead of switching to MongoDB/GeoJSON order, just clearly mark which
value is latitude and which is longitude.
Branch: remove-bootstrap
https://github.com/mongodb-js/compass/commit/edd623f8fc333e2ee991b4daa10c5ce5ae680313

Comment by Githook User [ 22/Feb/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(compass-schema): unambiguously display lat/long on map COMPASS-5526 (#2818)

GeoJSON (and thus MongoDB) stores coordinates as [Longitude, Latitude],
while elsewhere the reverse format [Latitude, Longitude] is common.

Compass displays the points on the map correctly, but reverses
the two values in the mouseover text.

Instead of switching to MongoDB/GeoJSON order, just clearly mark which
value is latitude and which is longitude.
Branch: main
https://github.com/mongodb-js/compass/commit/edd623f8fc333e2ee991b4daa10c5ce5ae680313

Comment by Githook User [ 22/Feb/22 ]

Author:

{'name': 'Anna Henningsen', 'email': 'anna@addaleax.net', 'username': 'addaleax'}

Message: fix(compass-schema): unambiguously display lat/long on map COMPASS-5526

GeoJSON (and thus MongoDB) stores coordinates as [Longitude, Latitude],
while elsewhere the reverse format [Latitude, Longitude] is common.

Compass displays the points on the map correctly, but reverses
the two values in the mouseover text.

Instead of switching to MongoDB/GeoJSON order, just clearly mark which
value is latitude and which is longitude.
Branch: 5526-dev
https://github.com/mongodb-js/compass/commit/cb09a1ced0bc1d62d9a85803c8f4eea6f6c35988

Comment by Anna Henningsen [ 22/Feb/22 ]

max23sim@gmail.com I also don’t know that, sorry. But I think we still want to modify the display of the coordinates when hovering over the dots, so I’ll leave this ticket open.

Comment by Maksim Simonenko [ 22/Feb/22 ]

I double-checked, and It looks like I was wrong. I apologize for wasting time, the issue can be closed.

But for me, it is still a secret why MongoDB chose a different format than the usual one.

Comment by Anna Henningsen [ 21/Feb/22 ]

max23sim@gmail.com Can you provide a single example of a point that is misplaced, with a screenshot?

The Great Pyramid of Giza is located at Lat = 29.979167, Lon = 31.134167. Correspondingly, in MongoDB, this would be entered as [31.134167, 29.979167]:

The schema analyzer places this on top of the actual pyramid, perfectly:

It’s only that it reverses the coordinates in that display, which it obviously shouldn’t.

Comment by Maksim Simonenko [ 21/Feb/22 ]

I checked 3-4 different map services and all have the same behavior as I expected. Also, I checked that I entered the right coordinates in the right place in the DB(just try to store [90, 180] instead of [180, 90] and you will face an error), the problem only with the representation on the schema tab.

Comment by Anna Henningsen [ 21/Feb/22 ]

max23sim@gmail.com But Compass does use [longitude, latitude] for placing the point, just not for displaying its coordinates on hover. (Note that e.g. Google Maps uses latitude, longitude order, which is different from what MongoDB expects in its database.)

Comment by Maksim Simonenko [ 21/Feb/22 ]

With the 1st part, I agree, with the 2nd no. Point showing in the wrong place on the map because used [latitude, longitude] coordinates instead of [longitude, latitude]
How to  reproduce:

  1. Go to google maps or another map service and copy coordinates of some point at the map.
  2. create an object in the DB with the coordinates. 
  3. check this point in the Compass schema tab.
    expected: point should be in the same place like at another map
    actual: point in a different place. 

In my opinion it's two related things

Comment by Anna Henningsen [ 21/Feb/22 ]

check the latitude and longitude on the map. They are reversed and the point is placed in the wrong place.

So, I think the first part is pretty clear, you’re right that this is buggy – the database stores points as [longitude, latitude], and the Compass schema tab displays them as [latitude, longitude] on mouseover. That qualifies as a bug for sure, thank you for bringing this up.

The second point is less clear. The points do appear on the right place of the map for me, e.g. a data point that is stored in the database as [-79.9283333, 9.4187222] shows up just off the coast of Panama (as it should) rather than in Antarctica. Are you saying that you’re seeing a different behavior here?

Comment by Maksim Simonenko [ 21/Feb/22 ]

Hi Anna,

yes, sure.

The object was created through Spring Data Repository(MongoDB reactive java driver).

Object in the DB:

 

Representation on the map in schema tab:

 

object from mongosh

 

Comment by Anna Henningsen [ 21/Feb/22 ]

max23sim@gmail.com Can you provide a full reproduction? In particular, how did you create the GeoJsonPoint object? What do the GeoJsonPoint object look like when you query the same collection with mongosh (https://www.mongodb.com/try/download/shell)?

Comment by Maksim Simonenko [ 20/Feb/22 ]

Sorry, can't edit the description and submit was by miss click.

So, how to reproduce:

  1. create an object with GeoJsonPoint with any coordinates
  2. go to schema analyzer 
  3. check the latitude and longitude on the map. They are reversed and the point is placed in the wrong place. 

 

Generated at Wed Feb 07 22:39:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.