當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript proj4.proj4函數代碼示例

本文整理匯總了TypeScript中core/util/proj4.proj4函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript proj4函數的具體用法?TypeScript proj4怎麽用?TypeScript proj4使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了proj4函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: doFormat

  doFormat(ticks, axis) {
    if ((this.dimension == null)) {
      throw new Error("MercatorTickFormatter.dimension not configured");
    }

    if (ticks.length === 0) {
      return [];
    }

    const proj_ticks = new Array(ticks.length);

    if (this.dimension === "lon") {
      for (let i = 0, end = ticks.length; i < end; i++) {
        const [lon,] = proj4(mercator).inverse([ticks[i], axis.loc]);
        proj_ticks[i] = lon;
      }
    } else {
      for (let i = 0, end = ticks.length; i < end; i++) {
        const [, lat] = proj4(mercator).inverse([axis.loc, ticks[i]]);
        proj_ticks[i] = lat;
      }
    }

    return super.doFormat(proj_ticks, axis);
  }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:25,代碼來源:mercator_tick_formatter.ts

示例2: get_ticks_no_defaults

  get_ticks_no_defaults(data_low: number, data_high: number, cross_loc: any, desired_n_ticks: number) {
    if (this.dimension == null) {
      throw new Error("MercatorTicker.dimension not configured")
    }

    [data_low, data_high] = clip_mercator(data_low, data_high, this.dimension)
    let proj_low: number, proj_high: number, proj_cross_loc: any

    if (this.dimension === "lon") {
      [proj_low,  proj_cross_loc] = proj4(mercator).inverse([data_low,  cross_loc]);
      [proj_high, proj_cross_loc] = proj4(mercator).inverse([data_high, cross_loc])
    } else {
      [proj_cross_loc, proj_low ] = proj4(mercator).inverse([cross_loc, data_low ]);
      [proj_cross_loc, proj_high] = proj4(mercator).inverse([cross_loc, data_high])
    }

    const proj_ticks = super.get_ticks_no_defaults(proj_low, proj_high, cross_loc, desired_n_ticks)

    const major: number[] = []
    const minor: number[] = []

    if (this.dimension === "lon") {
      for (const tick of proj_ticks.major) {
        if (in_bounds(tick, 'lon')) {
          const [lon] = proj4(mercator).forward([tick, proj_cross_loc])
          major.push(lon)
        }
      }
      for (const tick of proj_ticks.minor) {
        if (in_bounds(tick, 'lon')) {
          const [lon] = proj4(mercator).forward([tick, proj_cross_loc])
          minor.push(lon)
        }
      }
    } else {
      for (const tick of proj_ticks.major) {
        if (in_bounds(tick, 'lat')) {
          const [, lat] = proj4(mercator).forward([proj_cross_loc, tick])
          major.push(lat)
        }
      }
      for (const tick of proj_ticks.minor) {
        if (in_bounds(tick, 'lat')) {
          const [, lat] = proj4(mercator).forward([proj_cross_loc, tick])
          minor.push(lat)
        }
      }
    }

    return {
      major: major,
      minor: minor,
    }
  }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:54,代碼來源:mercator_ticker.ts

示例3: geographic_to_meters

 geographic_to_meters(xLon, yLat) {
   return  proj4(wgs84, mercator, [xLon, yLat]);
 }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:3,代碼來源:tile_utils.ts

示例4: meters_to_geographic

 meters_to_geographic(mx, my) {
   return  proj4(mercator, wgs84, [mx, my]);
 }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:3,代碼來源:tile_utils.ts

示例5: _get_projected_bounds

 _get_projected_bounds() {
   const [xstart, xend, ystart, yend] = this._get_latlon_bounds();
   const [proj_xstart, proj_ystart] = proj4(mercator, [xstart, ystart]);
   const [proj_xend, proj_yend] = proj4(mercator, [xend, yend]);
   return [proj_xstart, proj_xend, proj_ystart, proj_yend];
 }
開發者ID:FourtekIT-incubator,項目名稱:bokeh,代碼行數:6,代碼來源:gmap_plot_canvas.ts


注:本文中的core/util/proj4.proj4函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。