From cb09a1ced0bc1d62d9a85803c8f4eea6f6c35988 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 22 Feb 2022 11:13:23 +0100 Subject: [PATCH] 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. --- .../coordinates-minichart/coordinates-minichart.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/compass-schema/src/components/coordinates-minichart/coordinates-minichart.jsx b/packages/compass-schema/src/components/coordinates-minichart/coordinates-minichart.jsx index 6310cb3b3c4..8a4d4217433 100644 --- a/packages/compass-schema/src/components/coordinates-minichart/coordinates-minichart.jsx +++ b/packages/compass-schema/src/components/coordinates-minichart/coordinates-minichart.jsx @@ -69,17 +69,17 @@ const isValidLatLng = value => { }; /** - * Transforms an array `[lat,long]` coordinates into a GeoJSON Point. + * Transforms an array `[long, lat]` coordinates into a GeoJSON Point. * @param {Array} value `[long, lat]` * @returns {Object} */ const valueToGeoPoint = value => { - const [lat, lng] = [+value[0], +value[1]]; + const [lng, lat] = [+value[0], +value[1]]; const point = { type: 'Point', - coordinates: [lng, lat], - center: [lng, lat], + coordinates: [lat, lng], + center: [lat, lng], color: UNSELECTED_COLOR, /** * Passed to `` @@ -87,7 +87,7 @@ const valueToGeoPoint = value => { fields: [ { key: '[longitude, latitude]', - value: `[${[lng, lat].toString()}]` + value: `[Lat = ${lat}, Long = ${lng}]` } ] };