How to use the ngeo/datasource/OGC.js.Type.WMTS function in ngeo

To help you get started, we’ve selected a few ngeo 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 camptocamp / ngeo / contribs / gmf / src / import / importdatasourceComponent.js View on Github external
this.startWorking_();
    if (serviceType === Type.WMS) {
      this.ngeoQuerent_.wmsGetCapabilities(url).then(
        (wmsCapabilities) => {
          this.wmsCapabilities = wmsCapabilities;
          this.isLoading = false;
          this.stopWorking_();
          this.search();
        },
        () => {
          this.isLoading = false;
          // Something went wrong...
          this.stopWorking_(true);
        }
      );
    } else if (serviceType === Type.WMTS) {
      this.ngeoQuerent_.wmtsGetCapabilities(url).then(
        (wmtsCapabilities) => {
          this.wmtsCapabilities = wmtsCapabilities;
          this.isLoading = false;
          this.stopWorking_();
          this.search();
        },
        () => {
          this.isLoading = false;
          // Something went wrong...
          this.stopWorking_(true);
        }
      );
    } else {
      // Could not determine the type of url
      this.timeout_(() => {
github camptocamp / ngeo / contribs / gmf / src / datasource / ExternalDataSourcesManager.js View on Github external
let dataSource;

    // (2) Get data source from cache if it exists, otherwise create it
    if (this.extDataSources_[id]) {
      dataSource = this.extDataSources_[id];
    } else {

      const name = typeof layer.Title;
      const wmtsLayer = typeof layer.Identifier;

      // TODO - MaxScaleDenominator
      // TODO - MinScaleDenominator
      dataSource = new ngeoDatasourceOGC({
        id: id,
        name: name,
        ogcType: Type.WMTS,
        visible: true,
        wmtsLayer: wmtsLayer,
        wmtsUrl: wmtsUrl
      });

      // Keep a reference to the external data source in the cache
      this.extDataSources_[id] = dataSource;
    }

    // (3) Get/Create group, then add data source to group
    let wmtsGroup = this.getWMTSGroup(wmtsUrl);
    if (!wmtsGroup) {
      wmtsGroup = new ngeoDatasourceOGCGroup({
        dataSources: [],
        title: capabilities.ServiceIdentification.Title,
        url: wmtsUrl
github camptocamp / ngeo / contribs / gmf / src / import / importdatasourceComponent.js View on Github external
const url = this.url;
    const serviceType = guessServiceTypeByUrl(url);

    this.startWorking_();
    if (serviceType === Type.WMS) {
      this.ngeoQuerent_.wmsGetCapabilities(url).then(
        (wmsCapabilities) => {
          this.wmsCapabilities = wmsCapabilities;
          this.stopWorking_();
        },
        () => {
          // Something went wrong...
          this.stopWorking_(true);
        }
      );
    } else if (serviceType === Type.WMTS) {
      this.ngeoQuerent_.wmtsGetCapabilities(url).then(
        (wmtsCapabilities) => {
          this.wmtsCapabilities = wmtsCapabilities;
          this.stopWorking_();
        },
        () => {
          // Something went wrong...
          this.stopWorking_(true);
        }
      );
    } else {
      // Could not determine the type of url
      this.timeout_(() => {
        this.stopWorking_(true);
      });
    }
github camptocamp / ngeo / contribs / gmf / src / datasource / ExternalDataSourcesManager.js View on Github external
}

      const wmsGroup = this.getWMSGroup(dataSource.wmsUrl);
      if (wmsGroup && wmsGroup.dataSources.includes(dataSource)) {
        // Remove from group
        wmsGroup.removeDataSource(dataSource);

        // In case we removed the last data source from the group, then remove
        // and destroy the group, and remove the layer from the map as well.
        if (!wmsGroup.dataSources.length) {
          this.removeLayer_(wmsGroup.layer);
          wmsGroup.destroy();
          this.removeWMSGroup_(wmsGroup);
        }
      }
    } else if (dataSource.ogcType === Type.WMTS) {
      // WMTS data source
      if (!dataSource.wmtsUrl) {
        throw new Error('Missing dataSource.wmsUrl');
      }

      const wmtsGroup = this.getWMTSGroup(dataSource.wmtsUrl);
      if (wmtsGroup && wmtsGroup.dataSources.includes(dataSource)) {
        // Remove from group
        wmtsGroup.removeDataSource(dataSource);

        // Remove the cache item, in addition to removing the layer from the
        // map and unregister the watcher
        const id = dataSource.id;
        this.removeLayer_(this.wmtsCache_[id].layerObj);
        this.wmtsCache_[id].unregister();
        delete this.wmtsCache_[id];