#author("2022-07-04T01:09:22+09:00","default:Miyashita","Miyashita")
#author("2022-07-04T01:26:30+09:00","default:Miyashita","Miyashita")
*Google Earth Engine - 高度なカラーパレットを使う [#fff78510]

** 基本 [#wf6e83ae]
GiuHubに [[ee-palettes>https://github.com/gee-community/ee-palettes]] というパッケージがあってこれを呼べば一般的な科学的カラースケールを利用できる.~
呼び出し方は
#codeprettify(lang-js){{
// Pull the package from the GitHub repo which stores colour palettes to be used in GEE
// See https://github.com/gee-community/ee-palettes for more info
var palettes = require('users/gena/packages:palettes');
}}
で,そこからパレットを選び.最大最小値を決める.パレットの種類は上記の GitHub のリポジトリを参照のこと.
#codeprettify(lang-js){{
var vis = {
  min: -5.0,
  max: 100.0,
  palette: palettes.crameri.tofino[50],
};
}}
これで crameri の tonifo というパレットが 50 段階で変数に入る.~
~

**例 [#l32eef88]
標高分布を描いてみた例.~
読んでいる image は私の assets に入っているデータ(公開データではない).
#codeprettify(lang-js){{
// load
var image = ee.Image('users/miyashitafwk/topotif_tokyo');

// print information to console
print(image);

// Pull the package from the GitHub repo which stores colour palettes to be used in GEE
// See https://github.com/gee-community/ee-palettes for more info
var palettes = require('users/gena/packages:palettes');
var vis = {
  min: -5.0,
  max: 100.0,
  palette: palettes.crameri.tofino[50],
};

// show topohraphy (scientific colors)
Map.addLayer(image, vis, 'topo_tokyo_scientific'); // varname, color, label 
Map.centerObject(image, 11); // varname, zoom level
}}

#ref(https://main-t-miyashita.ssl-lolipop.jp/hydrocoast/image/GEE/color_palette0.png,815x364)



~
~


**参考 [#r005064a]
-[[Creating a vertical color bar in Google Earth Engine>https://gis.stackexchange.com/questions/422128/creating-a-vertical-color-bar-in-google-earth-engine]]

Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes