11.newLayer系列-VectorLayer-FromLo

2023-08-22  本文已影响0人  xueyueshuai
import VectorLayer from "ol/layer/Vector";
import VectorSource from "ol/source/Vector";
import GeoJSON from "ol/format/GeoJSON";

import data from './1.json'

let jsonData = data;


let xysGetVectorLayerFromLocal = () => {
  return new VectorLayer({
    name: 'oldBaseLayer',
    visible: true,
    source: new VectorSource({
      format: new GeoJSON(),
      features: new GeoJSON().readFeatures(jsonData),
    }),
  })
}

export default xysGetVectorLayerFromLocal
上一篇下一篇

猜你喜欢

热点阅读