How to use the ngeo/datasource/OGC.js.Type.WMS 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 / datasource / ExternalDataSourcesManager.js View on Github external
removeOGCDataSource_(dataSource) {
    if (dataSource.ogcType === Type.WMS) {
      // WMS data source
      if (!dataSource.wmsUrl) {
        throw new Error('Missing dataSource.wmsUrl');
      }

      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);
github camptocamp / ngeo / contribs / gmf / src / import / importdatasourceComponent.js View on Github external
connect() {
    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_();
        },
github camptocamp / ngeo / contribs / gmf / src / datasource / ExternalDataSourcesManager.js View on Github external
// queryable
      const queryable = layer.queryable === true &&
          wmsInfoFormat !== undefined;

      // TODO - MaxScaleDenominator
      // TODO - MinScaleDenominator
      /** @type {import('ngeo/datasource/OGC').OGCOptions} */
      const options = {
        id: id,
        name: layer.Title,
        ogcImageType: ogcImageType,
        wmsLayers: [{
          name: layer.Name,
          queryable: queryable
        }],
        ogcType: Type.WMS,
        visible: true,
        wmsUrl: url
      };
      if (wmsInfoFormat) {
        options.wmsInfoFormat = wmsInfoFormat;
      }
      dataSource = new ngeoDatasourceOGC(options);

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


    // (2) Add data source in WMS group, unless it's already in there.
    //     Will also add the data source to the `import('ngeo/datasource/DataSource.js').DataSources`
    //     collection.
github camptocamp / ngeo / contribs / gmf / src / import / importdatasourceComponent.js View on Github external
connect() {
    if (!this.url) {
      throw new Error('Missing url');
    }
    const url = this.url;
    const serviceType = guessServiceTypeByUrl(url);

    this.isLoading = true;
    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) => {