How to use layer-manager - 3 common examples

To help you get started, we’ve selected a few layer-manager 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 resource-watch / resource-watch / components / map / popup / component.js View on Github external
}, () => {
      axios.get(replace(interactionConfig.config.url, latlng))
        .then(({ data }) => {
          const { data: _data } = data;
          const { interaction: currentInteractions } = this.state;
          this.setState({
            interaction: {
              ...currentInteractions,
              [layer.id]: { data: _data[0] }
            },
            loading: false
          });
        })
        .catch((err) => {
          this.setState({ loading: false });
          if (err && err.json && typeof err.json === 'function') {
            err.json()
              .then((er) => { console.error(er); });
github resource-watch / resource-watch / components / modal / subscriptions-modal / actions.js View on Github external
const fetchs = datasets.map((dataset) => {
      const selectedSubscription = dataset.subscriptions.find(
        _subscription => _subscription.selected
      );

      if (selectedSubscription) {
        const { query } = selectedSubscription;
        return fetchQuery(token, replace(query, params));
      }

      return null;
    }).filter(e => e !== null);
github resource-watch / resource-watch / components / ui / map / popup / LayerPopup.js View on Github external
layersInteractionSelected
    } = data;

    const layer = layers.find(l => l.id === layersInteractionSelected) || layers[0];

    if (!layer) return false;

    const { interactionConfig } = layer;

    if (
      !isEmpty(latlng) &&
      !!layers.length &&
      !!interactionConfig.config &&
      !!interactionConfig.config.url
    ) {
      fetch(replace(interactionConfig.config.url, latlng))
        .then((response) => {
          if (response.ok) return response.json();
          throw response;
        })
        .then(({ data }) => {
          this.setState({
            interaction: {
              ...this.state.interaction,
              [layer.id]: {
                ...layer,
                data: data[0]
              }
            },
            loading: false
          });
        })

layer-manager

A library to get a layer depending on provider and layer spec

MIT
Latest version published 3 years ago

Package Health Score

43 / 100
Full package analysis

Popular layer-manager functions

Similar packages