mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Merge remote-tracking branch 'k-yle/custom-data-numbers-bug' into develop
This commit is contained in:
@@ -60,6 +60,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
#### :bug: Bugfixes
|
||||
* Fix hidden tooltips on map control toolbar ([#8781])
|
||||
* Fix glitching out turn restriction minimap on narrow sidebars ([#8792])
|
||||
* Fix non-string properties of GeoJSON custom map data not being displayed correctly ([#8825], thanks [@k-yle])
|
||||
* Fix a bug which made it impossible to switch to a custom TMS imagery layer after using a custom WMS source and vice versa ([#8057])
|
||||
* Fix a bug where the validator might show wrong tagging suggestions for a preset if another preset has a partial match ([#8828], thanks [@bhousel])
|
||||
* Show correct vintage and other metadata for "Esri World Imagery"'s higher zoom levels
|
||||
@@ -88,6 +89,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
[#8813]: https://github.com/openstreetmap/iD/issues/8813
|
||||
[#8817]: https://github.com/openstreetmap/iD/pull/8817
|
||||
[#8818]: https://github.com/openstreetmap/iD/issues/8818
|
||||
[#8825]: https://github.com/openstreetmap/iD/pull/8825
|
||||
[#8828]: https://github.com/openstreetmap/iD/pull/8828
|
||||
[#8831]: https://github.com/openstreetmap/iD/issues/8831
|
||||
[#8836]: https://github.com/openstreetmap/iD/issues/8836
|
||||
|
||||
@@ -315,6 +315,21 @@ export function svgData(projection, context, dispatch) {
|
||||
}
|
||||
|
||||
|
||||
function stringifyGeojsonProperties(feature) {
|
||||
const properties = feature.properties;
|
||||
for (const key in properties) {
|
||||
const property = properties[key];
|
||||
if (typeof property === 'number' || typeof property === 'boolean' || Array.isArray(property)) {
|
||||
properties[key] = property.toString();
|
||||
} else if (property === null) {
|
||||
properties[key] = 'null';
|
||||
} else if (typeof property === 'object') {
|
||||
properties[key] = JSON.stringify(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
drawData.setFile = function(extension, data) {
|
||||
_template = null;
|
||||
_fileList = null;
|
||||
@@ -332,6 +347,11 @@ export function svgData(projection, context, dispatch) {
|
||||
case '.geojson':
|
||||
case '.json':
|
||||
gj = JSON.parse(data);
|
||||
if (gj.type === 'FeatureCollection') {
|
||||
gj.features.forEach(stringifyGeojsonProperties);
|
||||
} else if (gj.type === 'Feature') {
|
||||
stringifyGeojsonProperties(gj);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { t } from '../../core/localizer';
|
||||
import { utilArrayDifference, utilArrayIdentical } from '../../util/array';
|
||||
import { utilGetSetValue, utilNoAuto, utilRebind, utilTagDiff } from '../../util';
|
||||
|
||||
|
||||
export function uiSectionRawTagEditor(id, context) {
|
||||
|
||||
var section = uiSection(id, context)
|
||||
|
||||
+10
-1
@@ -22,7 +22,11 @@ describe('iD.svgData', function () {
|
||||
' "area": 19717.8,' +
|
||||
' "name": "New Jersey",' +
|
||||
' "name_en": "New Jersey",' +
|
||||
' "osm_id": 316973311' +
|
||||
' "osm_id": 316973311,' +
|
||||
' "flag": true,' +
|
||||
' "list": [1,2,3],' +
|
||||
' "null": null,' +
|
||||
' "object": {}' +
|
||||
' },' +
|
||||
' "id": 316973311' +
|
||||
' }' +
|
||||
@@ -171,6 +175,11 @@ describe('iD.svgData', function () {
|
||||
path = surface.selectAll('path.stroke');
|
||||
expect(path.nodes().length).to.eql(1);
|
||||
expect(path.attr('d')).to.match(/^M.*z$/);
|
||||
expect(render.geojson().features[0].properties.osm_id).to.be.a('string');
|
||||
expect(render.geojson().features[0].properties.flag).to.be.a('string');
|
||||
expect(render.geojson().features[0].properties.list).to.be.a('string');
|
||||
expect(render.geojson().features[0].properties.null).to.be.a('string');
|
||||
expect(render.geojson().features[0].properties.object).to.be.a('string');
|
||||
done();
|
||||
}, 200);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user