Skip to content

Commit

Permalink
fix(GeojsonParser): store geojson properties within a separate property
Browse files Browse the repository at this point in the history
  • Loading branch information
mgermerie authored and gchoqueux committed Apr 20, 2021
1 parent b0f0a2d commit 121b796
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Parser/GeoJsonParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ function jsonFeatureToFeature(crsIn, crsOut, json, filteringExtent, options, col
// copy other properties
for (const key of Object.keys(json)) {
if (!keyProperties.includes(key.toLowerCase())) {
properties[key] = json[key];
// create `geojson` key if it does not exist yet
properties.geojson = properties.geojson || {};
// add key defined property to `geojson` property
properties.geojson[key] = json[key];
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/functional/source_stream_wfs_25d.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('source_stream_wfs_25d', function _() {
it('should pick the correct building', async () => {
// test picking
const buildingId = await page.evaluate(() => picking({ x: 97, y: 213 }));
assert.equal(buildingId.id, 'bati_indifferencie.5266051');
assert.equal(buildingId.geojson.id, 'bati_indifferencie.5266051');
});
it('should remove GeometryLayer', async () => {
const countGeometryLayerStart = await page.evaluate(() => view.getLayers(l => l.isGeometryLayer).length);
Expand Down

0 comments on commit 121b796

Please sign in to comment.