Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
GeoMap: Ignore points with null coordinate values (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwu-tow authored Aug 19, 2021
1 parent 8afed22 commit 525b340
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@

#### Enso Compiler

- [GeoMap visualization will ignore points with `null` coordinates][1775]. Now
the presence of such points in the dataset will not break initial map
positioning.
- [Updated Enso engine to version 0.2.11][1798]. If you're interested in the
enhancements and fixes made to the Enso compiler, you can find their release
notes [here](https://github.com/enso-org/enso/blob/main/RELEASES.md).

[1775]: https://github.com/enso-org/ide/pull/1775
[1798]: https://github.com/enso-org/ide/pull/1798

# Enso 2.0.0-alpha.11 (2021-08-09)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class GeoMapVisualization extends Visualization {

extractDataPoints(data, this.dataPoints, this.accentColor)
if (this.dataPoints.length === 0) {
// We have no valid data and should skip initialisation.
// We have no valid data and should skip initialization.
return false
}
const { latitude, longitude } = this.centerPoint()
Expand Down Expand Up @@ -219,7 +219,7 @@ class GeoMapVisualization extends Visualization {
}

/**
* Reset the internal state of the visualisation, discarding all previous data updates.
* Reset the internal state of the visualization, discarding all previous data updates.
*/
resetState() {
// We only need to reset the data points as everything else will be overwritten when new
Expand Down Expand Up @@ -288,7 +288,7 @@ class GeoMapVisualization extends Visualization {
}

/**
* Extract the visualisation data from a full configuration object.
* Extract the visualization data from a full configuration object.
*/
function extractVisualizationDataFromFullConfig(parsedData, preparedDataPoints, accentColor) {
if (parsedData.type === SCATTERPLOT_LAYER && parsedData.data.length) {
Expand All @@ -306,7 +306,7 @@ function extractVisualizationDataFromFullConfig(parsedData, preparedDataPoints,
}

/**
* Extract the visualisation data from a dataframe.
* Extract the visualization data from a dataframe.
*/
function extractVisualizationDataFromDataFrame(parsedData, preparedDataPoints, accentColor) {
const geoPoints = parsedData.df_latitude.map(function (latitude, i) {
Expand Down Expand Up @@ -348,11 +348,13 @@ function extractDataPoints(parsedData, preparedDataPoints, accentColor) {
*/
function pushPoints(dataPoints, targetList, accentColor) {
dataPoints.forEach(geoPoint => {
let position = [geoPoint.longitude, geoPoint.latitude]
let radius = isValidNumber(geoPoint.radius) ? geoPoint.radius : DEFAULT_POINT_RADIUS
let color = ok(geoPoint.color) ? geoPoint.color : accentColor
let label = ok(geoPoint.label) ? geoPoint.label : ''
targetList.push({ position, color, radius, label })
if (isValidNumber(geoPoint.longitude) && isValidNumber(geoPoint.latitude)) {
let position = [geoPoint.longitude, geoPoint.latitude]
let radius = isValidNumber(geoPoint.radius) ? geoPoint.radius : DEFAULT_POINT_RADIUS
let color = geoPoint.color ?? accentColor
let label = geoPoint.label ?? ''
targetList.push({ position, color, radius, label })
}
})
}

Expand Down

0 comments on commit 525b340

Please sign in to comment.