Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

grd2kml.rst 8.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
  1. .. index:: ! grd2kml
  2. .. include:: module_core_purpose.rst_
  3. *******
  4. grd2kml
  5. *******
  6. |grd2kml_purpose|
  7. Synopsis
  8. --------
  9. .. include:: common_SYN_OPTs.rst_
  10. **gmt grd2kml** *grid*
  11. [ |-A|\ **a**\|\ **g**\|\ **s**\ [*altitude*] ]
  12. [ |-C|\ *cpt* ]
  13. [ |-E|\ *URL* ]
  14. [ |-F|\ *filtercode* ]
  15. [ |-H|\ *factor* ]
  16. [ |-I|\ [*intensfile*\|\ *intensity*\|\ *modifiers*] ]
  17. [ |-L|\ *tilesize* ]
  18. [ |-N|\ *prefix* ]
  19. [ |-S|\ [*extra*] ]
  20. [ |-T|\ *title* ]
  21. [ |-W|\ *cfile*\|\ *pen*\ [**+s**\ *scale*/*limit*] ]
  22. [ |SYN_OPT-V| ]
  23. [ |SYN_OPT-f| ]
  24. [ |SYN_OPT--| ]
  25. |No-spaces|
  26. Description
  27. -----------
  28. **grd2kml** reads a 2-D grid file and makes a *quadtree* of
  29. PNG or JPG images and KML wrappers for Google Earth using the selected
  30. tile size. We downsample the grid depending on the
  31. viewing level in the quadtree using a Gaussian filter, but other
  32. filters can be selected as well.
  33. Optionally, illumination may be added by providing a grid file with
  34. intensities in the (-1,+1) range or by giving instructions to derive intensities
  35. from the input data grid automatically (see **-I**). Values outside the (-1,+1) intensity range will be
  36. clipped. Map colors are specified via a color palette lookup table. Contour overlays are optional.
  37. If plain tiles are selected (i.e., no contours specified) then the PNG tiles are written directly from
  38. :doc:`grdimage`. Otherwise, we must first make a PostScript plot that is then converted to raster image via
  39. :doc:`psconvert`.
  40. Required Arguments
  41. ------------------
  42. *grid*
  43. A 2-D gridded data set (See GRID FILE FORMATS below.)
  44. Optional Arguments
  45. ------------------
  46. .. _-A:
  47. **-A**\ **a**\|\ **g**\|\ **s**\ [*altitude*]
  48. Select one of three altitude modes recognized by Google Earth that
  49. determines the altitude (in m) of the tile layer: **a** absolute
  50. altitude, **g** altitude relative to sea surface or ground, **s**
  51. altitude relative to seafloor or ground. To plot the tiles at a
  52. fixed altitude, append an altitude *altitude* (in m). Use 0 to clamp the
  53. features to the chosen reference surface. [By default the tiles are clamped
  54. to the sea surface or ground].
  55. .. _-C:
  56. .. include:: use_cpt_grd.rst_
  57. .. _-E:
  58. **-E**\ *URL*
  59. Instead of hosting all files on your computer, you may prepend a remote site URL. Then,
  60. the top-level *prefix*\ .kml file will use this URL to find all other files it references.
  61. After building completes you must place the entire *prefix* directory at the remote
  62. location pointed to by the *URL* [local files only]. With this arrangement you can
  63. share the *prefix*\ .kml with others (say, via email or for download) and users can
  64. open the file in their Google Earth and access the remote files from your server as needed.
  65. .. _-F:
  66. **-F**\ *filtercode*
  67. Specifies the filter to use for the downsampling of the grid for more
  68. distant viewing. Choose among **b**\ oxcar, **c**\ osine arch,
  69. **g**\ aussian, or **m**\ edian [Gaussian]. The filter width is set
  70. automatically depending on the level.
  71. .. _-H:
  72. **-H**\ *factor*
  73. Improve the quality of rasterization by passing the sub-pixel smoothing factor
  74. to psconvert (same as **-H** option in psconvert) [no sub-pixel smoothing].
  75. Ignored when **-W** is not used.
  76. .. _-I:
  77. **-I**\ [*intensfile*\|\ *intensity*\|\ *modifiers*]
  78. Gives the name of a grid file with intensities in the (-1,+1) range,
  79. or a constant intensity to apply everywhere (affects the ambient light).
  80. Alternatively, derive an intensity grid from the input data grid *grid*
  81. via a call to :doc:`grdgradient`; append **+a**\ *azimuth* and **+n**\ *args*
  82. to specify azimuth and intensity arguments for that module or just give **+d**
  83. to select the default arguments (**+a**\ -45\ **+nt**\ 1). If you want a more
  84. specific intensity scenario then run :doc:`grdgradient` separately first.
  85. [Default is no illumination].
  86. .. _-L:
  87. **-L**\ *tilesize*
  88. Sets the fixed size of the image building blocks. Must be an integer that
  89. is radix 2. Typical values are 256 or 512 [256]. **Note**: For global
  90. grids (here meaning 360-degree longitude range), we will select a
  91. *tilesize* of 360 if **-L** is not specified.
  92. .. _-N:
  93. **-N**\ *prefix*
  94. Sets a unique name prefixed used for the top-level KML filename *and* the
  95. directory where all referenced KML files and raster images will be written [GMT_Quadtree].
  96. .. _-S:
  97. **-S**\ [*extra*]
  98. Add extra layers beyond that necessary to capture the full resolution of the data [none].
  99. This will let GMT interpolate your grid and make more tiles, versus letting Google Earth
  100. interpolate the last resolution raster images.
  101. .. _-T:
  102. **-T**\ *title*
  103. Sets the title of the top-level document (i.e., its description).
  104. .. _-V:
  105. .. |Add_-V| unicode:: 0x20 .. just an invisible code
  106. .. include:: explain_-V.rst_
  107. .. _-W:
  108. **-W**\ *cfile*\|\ *pen*\ [**+s**\ *scale*/*limit*]
  109. Supply a file with records each holding a contour value and a contour pen.
  110. We then overlay the selected contour lines on top of the image [no contours].
  111. Consequently, **-W** triggers the tile creation via PostScript and thus is slower.
  112. If *cfile* is not a valid file we assume you instead gave a *pen* and want
  113. to draw all the contours implied by the *cpt* specified in **-C**. The contours
  114. are overlain via calls to :doc:`grdcontour`. **Note**: The contour pen width(s)
  115. refer to the highest tile level and are reduced by a factor of *scale* [sqrt(2)] for each
  116. lower level. Contours with scaled pen widths < *limit* [0.1] points are skipped (except
  117. for pen widths that exactly equal 0 or "faint"). Use **+s** to change these values.
  118. .. |Add_-f| unicode:: 0x20 .. just an invisible code
  119. .. include:: explain_-f.rst_
  120. Quadtree building
  121. -----------------
  122. We extend the input grid vi :doc:`grdcut` to obtain a square dimension that can be repeatedly divided by 2
  123. until we arrive at tiles with the original grid increments. For global grids this mean we
  124. extend the grid to a 360 x 360 Cartesian region and an initial grid increment of one
  125. degree. This is the first global tile. As the quartering of tiles and halving of grid
  126. increment continue we may not end exactly at the original grid spacing but at the largest
  127. increment less than or equal to the original increment. For non-global grids, e.g., smaller
  128. (local or regional) grids, we extend the domain to a radix-2 multiple of the *tilesize*
  129. times the grid increment. This initial tile is then quartered and the grid increment halved
  130. until we reach the original grid increment. Tiles that have all NaNs are not produced.
  131. THe tiles are inherently pixel-registered. Thus, if a global grid has gridline-registration then
  132. we are down-sampling the extended grid onto a pixel-registered coarser grid. Because these
  133. nodes do not coincide with the original nodes we widen the filter width by a factor of sqrt(2).
  134. We detect if NaNs are present in any tile and if so produce a transparent PNG tile; otherwise we
  135. make an opaque JPG tile.
  136. Contour overlays
  137. ----------------
  138. Because each tile is a fixed size image (e.g., 512x512 pixels) but the amount of data represented
  139. changes by factors of 4 for each new level, we cannot use a constant thickness contour pen for all
  140. levels. Thus, the pen you supply must be considered the final pen applied to the highest resolution
  141. map overlays. Furthermore, because the *dpi* here is very small compared to regular GMT plots, it is
  142. important to improve the appearance of the contours by using sub-pixel smoothing (**-H**). Both
  143. generating PostScript tiles and using sub-pixel smoothing adds considerable processing time over
  144. plain tiles.
  145. Notes
  146. -----
  147. The intensity grid can be created from the data grid using
  148. :doc:`grdgradient` and, optionally, modified by :doc:`grdmath` or
  149. :doc:`grdhisteq`. Custom intensity grids built with several different
  150. illumination angles can be combined with :doc:`grdmath`. For a single
  151. illumination angle the automatic illumination can be used instead.
  152. Examples
  153. --------
  154. .. include:: explain_example.rst_
  155. To test a quadtree image representation of the coarse topography grid earth_relief_06m, using
  156. the optimally determined tile size, auto color, and supplying a suitable title, try::
  157. gmt grd2kml @earth_relief_06m -NEarth6m -T"Earth Relief 6x6 arc minutes" -Cearth
  158. To make a quadtree image representation of the large topography grid file ellice_basin.nc,
  159. supplying automatic shading based on the topography, and using 512x512 tiles,
  160. supplying a suitable title, and using color masking for unmapped area, try::
  161. gmt grd2kml ellice_basin.nc -I+d -Nellice -L512 -T"Ellice Basin Bathymetry"
  162. See Also
  163. --------
  164. :doc:`gmt`,
  165. :doc:`gmt.conf`,
  166. :doc:`gmt2kml`,
  167. :doc:`grdgradient`,
  168. :doc:`grdhisteq`,
  169. :doc:`grdimage`,
  170. :doc:`grdmath`,
  171. :doc:`kml2gmt`,
  172. :doc:`psconvert`
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...