Skip to content

Commit 2e490be

Browse files
user namexilanhuaweidapao
authored andcommitted
icl-1418 geometry id 设置不起作用 review by songym
1 parent 775b3bb commit 2e490be

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/common/format/GeoJSON.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ export class GeoJSON extends JSONFormat {
612612
feature.bounds = Bounds.fromArray(bbox);
613613
}
614614
if (obj.id) {
615+
feature.geometry.id = obj.id;
615616
feature.fid = obj.id;
616617
}
617618
return feature;

test/common/format/GeoJSONSpec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,4 +740,21 @@ describe('GeoJSON', () => {
740740
expect(obj.geometry.points[0].x).toBe(10);
741741
expect(obj.geometry.points[0].y).toBe(10);
742742
});
743+
744+
it('geometry id same as feature id', () => {
745+
var feature = {
746+
type: 'Feature',
747+
properties: {
748+
POP: 1,
749+
CAPITAL: 'test'
750+
},
751+
id: 3,
752+
geometry: {
753+
type: 'Point',
754+
coordinates: [108, 44]
755+
}
756+
};
757+
var result = new GeoJSON().read(feature, feature.type);
758+
expect(result.geometry.id).toBe(3);
759+
});
743760
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy