美文网首页
11.newLayer系列-VectorLayer-FromLo

11.newLayer系列-VectorLayer-FromLo

作者: xueyueshuai | 来源:发表于2023-08-22 14:08 被阅读0次
    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
    

    相关文章

      网友评论

          本文标题:11.newLayer系列-VectorLayer-FromLo

          本文链接:https://www.haomeiwen.com/subject/efykpdtx.html