【发布时间】:2019-12-04 01:55:05
【问题描述】:
我使用 angular 8。我的资产文件夹中有一个 geojson 填充:
{ "type": "FeatureCollection",
"features": [
{ "type": "Feature", "geometry": {"type": "Point", "coordinates": [9.15926605,41.38718765]},"properties": {"f":"2A0000212","n":"HOPITAL LOCAL DE BONIFACIO","c":"20169 BONIFACIO","t":"2"}},
{ "type": "Feature", "geometry": {"type": "Point", "coordinates": [9.15926605,41.38718765]},"properties": {"f":"2A0003141","n":"ANTENNE DU SMUR BONIFACIO","c":"20169 BONIFACIO","t":"2"}},
...
]}
我想通过属性“t”过滤我的 geojson 数据(使用 mat-select-form 和 NgModel。
例如,过滤 json 中具有属性 "t" = 2 的项目
//Component.ts
json;
constructor( private http: HttpClient) {}
ngOnInit() {this.http.get('assets/es.json').subscribe((json: any) => { this.json = json;});}
【问题讨论】:
-
this post 的答案应该可以帮助您朝着正确的方向前进。
-
谢谢我试着理解答案^^
标签: angular typescript filter rxjs geojson