CesiumGS / CesiumGS/cesium

Improve name fallback for GeoJSON

Open
#11,633 5 comments 0 reactions 0 assignees View on GitHub
category - entity category - vector data type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
3d 15h
Merged PRs (30d)
32

Description

We have files that are generated with empty title and descriptions, but a filled key called `country-name`.

Eg:

```
"properties": {
"title": "",
"description": "",
"country-name": "North Carolina",
"two-letter-code": "NC",
"fill": "#f0a3FF",
"fill-opacity": "0.5
},
```

The GeoJsonDataSource file loops through and attempts to figure out what name property to use. If `country-name` comes before title, it uses that, but if it comes after it assumes title, which is empty.

Current behavior:

* title second, filled : country-name first, filled: uses title [countryNameFirstTitleFilled.json](https://github.com/CesiumGS/cesium/files/13396842/countryNameFirstTitleFilled.json)
* title first, filled : country-name second, filled: uses title [countryNameFirstTitleEmpty.json](https://github.com/CesiumGS/cesium/files/13396841/countryNameFirstTitleEmpty.json)
* title first, empty : country-name second, filled: uses title [titleFirstEmptyCountryNameSecond.json](https://github.com/CesiumGS/cesium/files/13396840/titleFirstEmptyCountryNameSecond.json)
* title second, empty : country-name first, filled: uses country-name

https://github.com/CesiumGS/cesium/blob/main/packages/engine/Source/DataSources/GeoJsonDataSource.js#L151C11-L164

Is it possible/would it be ok to add an additional check to:

* Check if value of key is empty and if so, check the next key.

The preferred behavior is to show `x-name` even if it shows up after an empty title but only if the title is empty.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.