How to use the @terrestris/base-util/dist/UrlUtil/UrlUtil.objectToRequestString function in @terrestris/base-util

To help you get started, we’ve selected a few @terrestris/base-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 / ol-util / src / MapUtil / MapUtil.js View on Github external
const isImageWMS = source instanceof OlSourceImageWMS;

    if (isTiledWMS || isImageWMS) {
      const source = layer.getSource();
      const url = isTiledWMS ?
        source.getUrls() ? source.getUrls()[0] : ''
        : source.getUrl();
      const params = {
        LAYER: source.getParams().LAYERS,
        VERSION: '1.3.0',
        SERVICE: 'WMS',
        REQUEST: 'getLegendGraphic',
        FORMAT: 'image/png'
      };

      const queryString = UrlUtil.objectToRequestString(
        Object.assign(params, extraParams));

      return /\?/.test(url) ? `${url}&${queryString}` : `${url}?${queryString}`;
    } else {
      Logger.warn(`Source of "${layer.get('name')}" is currently not supported `
        + `by MapUtil.getLegendGraphicUrl.`);
      return;
    }
  }
github terrestris / react-geo / src / Field / NominatimSearch / NominatimSearch.tsx View on Github external
doSearch() {
    const baseParams = {
      format: this.props.format,
      viewbox: this.props.viewbox,
      bounded: this.props.bounded,
      polygon_geojson: this.props.polygon_geojson,
      addressdetails: this.props.addressdetails,
      limit: this.props.limit,
      countrycodes: this.props.countrycodes,
      q: this.state.searchTerm
    };

    const getRequestParams = UrlUtil.objectToRequestString(baseParams);

    fetch(`${this.props.nominatimBaseUrl}${getRequestParams}`)
      .then(response => response.json())
      .then(this.onFetchSuccess.bind(this))
      .catch(this.onFetchError.bind(this));
  }
github terrestris / react-geo / src / Field / CoordinateReferenceSystemCombo / CoordinateReferenceSystemCombo.tsx View on Github external
fetchCrs = (searchVal) => {
    const { crsApiUrl } = this.props;

    const queryParameters = {
      format: 'json',
      q: searchVal
    };

    return fetch(`${crsApiUrl}?${UrlUtil.objectToRequestString(queryParameters)}`)
      .then(response => response.json());
  }