File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -612,6 +612,7 @@ export class GeoJSON extends JSONFormat {
612
612
feature . bounds = Bounds . fromArray ( bbox ) ;
613
613
}
614
614
if ( obj . id ) {
615
+ feature . geometry . id = obj . id ;
615
616
feature . fid = obj . id ;
616
617
}
617
618
return feature ;
Original file line number Diff line number Diff line change @@ -740,4 +740,21 @@ describe('GeoJSON', () => {
740
740
expect ( obj . geometry . points [ 0 ] . x ) . toBe ( 10 ) ;
741
741
expect ( obj . geometry . points [ 0 ] . y ) . toBe ( 10 ) ;
742
742
} ) ;
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
+ } ) ;
743
760
} ) ;
You can’t perform that action at this time.
0 commit comments