How to use the @terrestris/ol-util/dist/FileUtil/FileUtil.addGeojsonLayerFromFile function in @terrestris/ol-util

To help you get started, we’ve selected a few @terrestris/ol-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github terrestris / react-geo / src / HigherOrderComponent / DropTargetMap / DropTargetMap.tsx View on Github external
onDrop(event: DragEvent) {
      const {
        map
      } = this.props;

      event.preventDefault();
      const files = event.dataTransfer.files;
      if (files.length > 0) {
        for (let i = 0; i < files.length; ++i) {
          const file = files[i];
          if (file.name.match(/\.zip$/g)) {
            FileUtil.addShpLayerFromFile(file, map);
          } else {
            FileUtil.addGeojsonLayerFromFile(file, map);
          }
        }
      }
    }