Skip to content

Commit

Permalink
fixed map coordinate numeric fields precision in popup (#3553)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Ricci <[email protected]>
  • Loading branch information
SteRiccio and SteRiccio authored Sep 2, 2024
1 parent 3effd09 commit 8240e22
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import circleToPolygon from 'circle-to-polygon'
import L from 'leaflet'
import axios from 'axios'

import { Objects, PointFactory } from '@openforis/arena-core'
import { Objects, PointFactory, DEFAULT_SRS } from '@openforis/arena-core'

import * as NumberUtils from '@core/numberUtils'
import * as Survey from '@core/survey/survey'
import * as NodeDef from '@core/survey/nodeDef'
import * as SamplingPolygon from '@core/survey/SamplingPolygon'
Expand Down Expand Up @@ -130,9 +131,11 @@ export const CoordinateAttributePopUp = (props) => {
})
}, [getGeoJson, surveyId])

const coordinateNumericFieldPrecision = point.srs === DEFAULT_SRS.code ? 6 : NaN

const content = `**${path}**
* **X**: ${point.x}
* **Y**: ${point.y}
* **X**: ${NumberUtils.roundToPrecision(point.x, coordinateNumericFieldPrecision)}
* **Y**: ${NumberUtils.roundToPrecision(point.y, coordinateNumericFieldPrecision)}
* **SRS**: ${point.srs}
* **${i18n.t('mapView.altitude')}**: ${altitude}
* **${i18n.t('common.owner')}**: ${recordOwnerName ?? '...'}`
Expand Down

0 comments on commit 8240e22

Please sign in to comment.