import { of } from 'rxjs';
import GeoJSON from 'ol/format/GeoJSON';
import { map } from 'rxjs/operators';
export class SpecialMenuComponent implements OnInit {
ngOnInit(): void {
of(geojson)
.pipe(map((item: any) => new GeoJSON().readFeatures(item)))
.subscribe(result => {
console.log(result);
});
}
}
const geojson = {
type: 'Feature',
properties: {},
geometry: {
type: 'LineString',
coordinates: [[105.6005859375, 30.65681556429287],
[107.95166015624999, 31.98944183792288],
[109.3798828125, 30.031055426540206],
[107.7978515625, 29.935895213372444]]
}
};
angular(rxjs)将geojson转换为Features
最新推荐文章于 2025-03-28 09:32:04 发布