Skip to content

Commit 7d762b4

Browse files
committed
Add mosaic docs
1 parent 04bc518 commit 7d762b4

File tree

15 files changed

+187
-94
lines changed

15 files changed

+187
-94
lines changed

_assets/common_opts/opt__j.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- **j** or **spherical_dist** or **spherical** : -- *spherical=greatcirc* or *spherical=:flat* or *spherical=:ellipsoidal*\
1+
- **j** or **metric** or **spherical_dist** or **spherical** : -- *metric=greatcirc* or *spherical=:flat* or *spherical=:ellipsoidal*\
22
Determine how spherical distances are calculated in modules that support this [Default is `spherical=:greatcirc`].
33
GMT has different ways to compute distances on planetary bodies:
44

documentation/all_docs_ref/all_refs.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ its use requires resorting to the \myreflink{Monolithic} mode.
4646
| | | | | | | | | | |
4747
|:-----|:----|:----|:----|:----|:----|:----|:----|:----|:----|
4848
| \myreflink{ablines} | \myreflink{append2fig} | \myreflink{blendimg!} | \myreflink{colorzones!} | \myreflink{cpt4dcw} | \myreflink{crop} | \myreflink{cubeplot} | \myreflink{imagesc} | \myreflink{inwhichpolygon} | \myreflink{lelandshade} |
49-
| \myreflink{coastlinesproj} | \myreflink{cubeslice} | \myreflink{gadm} | \myreflink{geodetic2enu} | \myreflink{info} | \myreflink{lelandshade} | \myreflink{linearfitxy} | \myreflink{getbyattrib} | \myreflink{gmtread} | \myreflink{gmtwrite} |
50-
| \myreflink{graticules} | \myreflink{gridit} | \myreflink{image_alpha!} | \myreflink{image_cpt!} | \myreflink{imshow} | \myreflink{ind2rgb} | \myreflink{mat2ds} | \myreflink{mat2grid} | \myreflink{mat2img} | \myreflink{orbits} |
51-
| \myreflink{pca} | \myreflink{plotgrid!} | \myreflink{polygonlevels} | \myreflink{rasterzones!} | \myreflink{rescale} | \myreflink{slicecube} | \myreflink{stackgrids} | \myreflink{theme} | \myreflink{wmsinfo} | \myreflink{wmsread} |
52-
| \myreflink{wmstest} | \myreflink{worldrectgrid} | \myreflink{worldrectcoast} | \myreflink{worldrectangular} | \myreflink{xyzw2cube} | | | | | |
49+
| \myreflink{coastlinesproj} | \myreflink{cubeslice} | \myreflink{gadm} | \myreflink{geocoder} | \myreflink{geodetic2enu} | \myreflink{info} | \myreflink{lelandshade} | \myreflink{linearfitxy} | \myreflink{getbyattrib} | \myreflink{gmtread} |
50+
| \myreflink{gmtwrite} | \myreflink{graticules} | \myreflink{gridit} | \myreflink{image_alpha!} | \myreflink{image_cpt!} | \myreflink{imshow} | \myreflink{ind2rgb} | \myreflink{mat2ds} | \myreflink{mat2grid} | \myreflink{mat2img} |
51+
| \myreflink{mosaic} | \myreflink{orbits} | \myreflink{pca} | \myreflink{plotgrid!} | \myreflink{polygonlevels} | \myreflink{rasterzones!} | \myreflink{rescale} | \myreflink{slicecube} | \myreflink{stackgrids} | \myreflink{theme} |
52+
| \myreflink{wmsinfo} | \myreflink{wmsread} | \myreflink{wmstest} | \myreflink{worldrectgrid} | \myreflink{worldrectcoast} | \myreflink{worldrectangular} | \myreflink{xyzw2cube} | | | |
5353

5454
## Utility functions
5555

documentation/modules/arrows.md

-65
This file was deleted.

documentation/modules/filter1d.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Optional Arguments
9393
convolution. Enter *q_factor* between 0 and 1. If mean weight <
9494
*q_factor*, output is suppressed at this point [Default does not check Quality].
9595

96-
- **S** or **symetry** : -- *symetry=factor*\
96+
- **S** or **symmetry** : -- *symmetry=factor*\
9797
Checks symmetry of data about window center. Enter a factor between
9898
0 and 1. If ( (abs(n_left - n_right)) / (n_left + n_right) ) >
9999
*factor*, then no output will be given at this point [Default does not check Symmetry].

documentation/modules/gmtconnect.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ Optional Arguments
4646
segment header will be written and the segment headers of individual pieces will be written
4747
out as comments to make it possible to identify where the connected pieces came from.
4848

49-
- **L** or **linkfile** : -- *linkfile=true* **|** *linkfile="file"*\
50-
Writes link information to the specified file [gmtconnect_link.txt]. For each segment we
49+
- **L** or **links** or **linkfile** : -- *links=true* **|** *linkfile="file"*\
50+
Writes link information to the specified file [gmtconnect_link.txt] (or return its contents). For each segment we
5151
write the original segment id, and for the beginning and end point of the segment we report the
5252
id of the nearest segment, whether it is the beginning (B) or end (E) point that is closest,
5353
and the distance between those points in units determined by **tolerance**.
5454

55-
- **Q** or **list_file** : -- *list_file=true* **|** *list_file="template"*\
55+
- **Q** or **list** or **listfile** : -- *list=true* **|** *listfile="template"*\
5656
Used with **dump** to write a list file with the names of the individual output files.
5757
Optionally, append a filename template for the individual file names; this template
5858
**may** contain a C format specifier that can format an character (C or O for closed

documentation/modules/gmtconvert.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Optional Arguments
106106
combined with any other ordering scheme except **conn_method** (segmentation)
107107
and is applied at the end.
108108

109-
- **Q** or **select_num** : -- *select_num=[**~**]\ *selection* *\
109+
- **Q** or **segments** : -- *segments=[**~**]\ *selection* *\
110110
Only write segments whose number is included in *selection* and skip
111111
all others. Cannot be used with |-S|. The *selection* syntax is
112112
*range*[,*range*,...] where each *range* of items is either a single
@@ -239,7 +239,7 @@ of records within each segment, try:
239239
To extract segments 20 to 40 in steps of 2, plus segment 0 in a file, try:
240240

241241
```julia
242-
convert("lots_of_segments.txt", select_num="0,20:2:40")
242+
convert("lots_of_segments.txt", segments="0,20:2:40")
243243
```
244244

245245
To extract the attribute ELEVATION from an ogr gmt file like this:

documentation/modules/gmtselect.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Optional Arguments
6464
Pass all locations that are inside the valid data area of the *grid*R, which can be either a
6565
file name or an *in-memory* grid object. Nodes that are outside are either NaN or zero.
6666

67-
- **I** or **reverse** or **revert** : -- *reverse=:c|f|l|r|s|z*\
67+
- **I** or **invert** or **reverse** : -- *invert=:c|f|l|r|s|z*\
6868
Reverses the sense of the test for each of the criteria specified:
6969

7070
- **c** - select records NOT inside any point's circle of influence.

documentation/modules/histogram.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Optional Arguments
4141
- **D** or **annot** or **annotate** or **count** : -- *annot=true* **|** *annot=(beneath=|font=|offset=|vertical=,)*\
4242
Annotate each bar with the count it represents. Add any of the following options: Use **annot=(beneath=true,)** to place the labels beneath the bars instead of above; use **annot=(font="font",)** to change to another font than the default annotation font; use **annot=(offset=val,)** to change the offset between bar and label [6p]; use **annot=(vertical=true,)** to rotate the labels from horizontal to vertical.
4343

44-
- **E** or **width** : -- *width=val* **|** *width=(width=val, offset=val)*\
44+
- **E** or **width** : -- *width=val* **|** *width=(width=val, offset=val)*\
4545
Use an alternative histogram bar width than the default set via **bin**, and optionally shift all bars by an offset. Here width is either an alternative width in data units, or the user may append a valid plot dimension unit ("c|i|p") for a fixed dimension instead. Optionally, all bins may be shifted along the axis by offset. As for width, it may be given in data units of plot dimension units by appending the relevant unit.
4646

4747
- **binmethod** or **BinMethod** : -- *binmethod=mthod*\
@@ -52,7 +52,7 @@ Optional Arguments
5252

5353
For DateTime data: "**second**", "**minute**", "**hour**", "**day**", "**week**", "**month**" or "**year**"
5454

55-
- **F** or **center** : -- *center=true*\
55+
- **F** or **center** : -- *center=true*\
5656
Center bin on each value. [Default is left edge].
5757

5858
- **full_histo** : -- *full_histo=true*\

documentation/utilities/geocoder.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# geocoder
2+
3+
```julia
4+
D = geocoder(address::String; options=String[])
5+
```
6+
7+
Get the geocoder info for a given address by calling the GDAL/OGR
8+
[geocoding functions](https://gdal.org/doxygen/ogr__geocoding_8h.html).
9+
10+
### Arguments
11+
- `address`: The string to geocode.
12+
13+
- `options`: These are the options passed to GDAL and in the form of a vector of strings. For example,
14+
the default is equivalent to `options=["SERVICE", "OSM_NOMINATIM"]`.
15+
- ``"CACHE_FILE"`` : Defaults to ``"ogr_geocode_cache.sqlite"`` (or otherwise ``"ogr_geocode_cache.csv"`` if the
16+
SQLite driver isn't available). Might be any CSV, SQLite or PostgreSQL datasource.
17+
- ``"READ_CACHE"`` : ``"TRUE"`` (default) or "FALSE"
18+
- ``"WRITE_CACHE"`` : ``"TRUE"`` (default) or "FALSE"
19+
- ``"SERVICE"``: ``"OSM_NOMINATIM"`` (default), ``"MAPQUEST_NOMINATIM"``, ``"YAHOO"``, ``"GEONAMES"``,
20+
``"BING"`` or other value.
21+
Note: ``"YAHOO"`` is no longer available as a free service.
22+
- ``"EMAIL"``: used by ``"OSM_NOMINATIM"``. Optional, but recommended.
23+
- ``"USERNAME"``: used by ``"GEONAMES"``. Compulsory in that case.
24+
- ``"KEY"``: used by BING. Compulsory in that case.
25+
- ``"APPLICATION"``: used to set the User-Agent MIME header. Defaults to GDAL/OGR version string.
26+
- ``"LANGUAGE"``: used to set the Accept-Language MIME header. Preferred language order for showing search results.
27+
- ``"DELAY"``: minimum delay, in second, between 2 consecutive queries. Defaults to 1.0.
28+
- ``"QUERY_TEMPLATE"``: URL template for GET requests. Must contain one and only one occurrence of %s in it.
29+
If not specified, for ``["SERVICE", "OSM_NOMINATIM"]``, ``"MAPQUEST_NOMINATIM"``, ``"YAHOO"``, ``"GEONAMES"``
30+
or ``"BING"``, the URL template is hard-coded.
31+
- ``"REVERSE_QUERY_TEMPLATE"``: URL template for GET requests for reverse geocoding. Must contain one and only
32+
one occurrence of {lon} and {lat} in it. If not specified, for ``["SERVICE", "OSM_NOMINATIM"]``,
33+
``"MAPQUEST_NOMINATIM"``, ``"YAHOO"``, ``"GEONAMES"`` or ``"BING"``, the URL template is hard-coded.
34+
35+
36+
Returns
37+
-------
38+
A \myreflink{GMTdataset} with the longitude, latitude, and full attribute dictionary returned by the geocoder for
39+
the input address. This dataset contains only one point but geocoding service resturns also a BoundingBox
40+
containing that point. When the `address` is very specific that BB is tiny arround the point, but when the
41+
query is general (for example,just the name of a city or even a country), the BB is large and may be very
42+
useful to use in the `mosaic` program. For that purpose, the returned BB is sored in the \myreflink{GMTdatset}
43+
``ds_bbox`` field.
44+
45+
Examples
46+
--------
47+
48+
```julia
49+
geocoder("Paris, France")
50+
```
51+
52+
See Also
53+
--------
54+
55+
\myreflink{mosaic}

documentation/utilities/gridit.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
G = gridit(fname="", indata=nothing; method="surface", gdopts="", proj="", epsg=0, kw...)
55
```
66

7-
*keywords: GMT, Julia, gris interpolations, GDAL interpolate*
7+
*keywords: GMT, Julia, 2D interpolations, grid interpolations, GDAL interpolate*
88

99
Wrapper function to interpolate scattered data into a grid.
1010
Interpolation methods may be those of GMT and GDAL (gdal_grid).
@@ -18,12 +18,12 @@ Interpolation methods may be those of GMT and GDAL (gdal_grid).
1818
"nearneighbor", "sphtriangulate", "greenspline". The arguments: "mean", "median", "mode", "std", "highest",
1919
"lowest" will compute those amounts inside each *rectangular* cell.
2020

21-
- Or (GDAL): "invdist", "invdistnn", "average", "nearest", "linear", "minimum", "maximum", "range",
22-
"count", "average_distance", "average_distance_pts". See https://gdal.org/programs/gdal_grid.html#gdal-grid
21+
- Or (GDAL): "invdist", "invdistnn", "average", "nearest", "linear", "minimum", "maximum", "range",
22+
"count", "average_distance", "average_distance_pts". See https://gdal.org/programs/gdal_grid.html#gdal-grid
2323

24-
- Note that there is some overlap between the diverse methods. For example, the GMT's \myreflink{nearneighbor}
25-
and GDAL's ``invdist`` apply the same algorithm (the Inverse Distance Weight) but they difer on how
26-
to select the points to do the weighted average.
24+
- Note that there is some overlap between the diverse methods. For example, the GMT's \myreflink{nearneighbor}
25+
and GDAL's `invdist` apply the same algorithm (the Inverse Distance Weight) but they difer on how
26+
to select the points to do the weighted average.
2727

2828
- `gdopts`: List of options, in the form of a single string, accepted by the gdal_grid utility. This option
2929
only applies to the GDAL methods.

documentation/utilities/mosaic.md

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# mosaic
2+
3+
```julia
4+
I = mosaic(lon, lat; pt_radius=6371007.0, provider="", zoom::Int=0, cache::String="",
5+
mapwidth=15, dpi=96, verbose::Int=0, kw...)
6+
```
7+
8+
*keywords: GMT, Julia, tiles image*
9+
10+
Get image tiles from a web map tiles provider for given longitude, latitude coordinates.
11+
12+
### Arguments
13+
- `lon` & `lat`:
14+
- `lon, lat` two scalars with the coordinates of region of interest center. To completly define
15+
the image area see the `neighbors` or `mosaic` option below.
16+
- `lon, lat` are two elements vector or matrix with the region's ``[lon_min, lon_max], [lat_min, lat_max]``.
17+
- Instead of two arguments, pass just one containing a GMTdataset obtained with the ``geocoder`` function.
18+
Example: ``mosaic(D, ...)`` or, if the search with ``geocoder`` was sufficiently generic (see its docs),
19+
``mosaic(D, bbox=true)`` to use the BoundingBox returned by the query. `bbox` supports `bb`, `BB` or
20+
`BoundingBox` as aliases.
21+
22+
- `pt_radius`: The planetary radius. Defaults to Earth's WGS84 authalic radius (6371007 m).
23+
24+
- `provider`: Tile provider name. Currently available options are (but for more details see the docs of the
25+
`getprovider` function, *i.e.* ``? getprovider``):
26+
- "Bing" (the default), "OSM", "Esri" or a custom provider.
27+
- A `Provider` type from the ``TileProviders.jl`` package. You must consult the documentation of that package
28+
for more details on how to choose a *provider*.
29+
30+
- `zoom`: Zoom level (0 for automatic). A number between 0 and ~19. The maximum is provider and area dependent.
31+
If `zoom=0`, the zoom level is computed automatically based on the `mapwidth` and `dpi` options.
32+
33+
- `cache`: Full name of the the cache directory where to save the downloaded tiles. If empty, a cache
34+
directory is created in the system's TMP directory. If `cache="gmt"` the cache directory is created in
35+
``~/.gmt/cache_tileserver``. NOTE: this normally is neeaded only for the first time you run this function when,
36+
if `cache!=""`, the cache dir location is saved in the ``~./gmt/tiles_cache_dir.txt`` file and used in
37+
subsequent calls.
38+
39+
- `mapwidth`: Map width in cm. Used together with the `dpi` option to automatically compute the zoom level.
40+
41+
- `dpi`: Dots per inch. Used together with the `mapwidth` option to automatically compute the zoom level.
42+
43+
- `verbose`: Verbosity level. A number between 0 and 2. Print out info while downloading the image files.
44+
Silent when geting files from local cache unless `verbose=2`, where it prints out info about the files
45+
found in the cache.
46+
47+
### kwargs (kw...)
48+
- `neighbors` or `mosaic`: When `lon` and `lat` are scalars, this option specifies the number of neighbors
49+
of the tile containing the query point to download. Normally this should be an odd number, but it can take the
50+
form of a matrix and the number of tiles is then determined by the number of rows and columns.
51+
52+
- `merc` or `mercator`: Return tiled image in Mercator coordinates. The default is to project it back
53+
to geographical coordinates.
54+
55+
- `loose` or `loose_bounds`: By default we return an image with the limits requested in the `lon` and
56+
`lat` arguments. This option makes it return an image with the limits that are determined by those of
57+
the tiles that intersect the requested region. Note that this does not work for point queries.
58+
59+
- `quadonly`: Return only the quadtree string. A string or a matrix of strings when number of tiles > 1.
60+
Other from the quadtree string this option return also the `decimal_adress, lon, lat, x, y` that are:
61+
the XYZ tiles coordinates, the longitude, latitude , mercator X and Y coordinates in meters of first tile.
62+
63+
Returns
64+
-------
65+
- `I`: A \myreflink{GMTimage} element or the output of the `quadonly` option explained above.
66+
67+
Examples
68+
--------
69+
70+
- Make a figure with OpenStreetMap over Iberia maintaining the original spherical Mercator projection.
71+
72+
\begin{examplefig}{}
73+
```julia
74+
using GMT
75+
76+
I = mosaic([-9.5, 3.3], [36.0, 43.8], provider=:OSM, zoom=7, merc=true)
77+
viz(I)
78+
```
79+
\end{examplefig}
80+
81+
82+
- Make a figure of the Big Island of Hawaii using the default Bing images. In this case
83+
we use the ``geocoder`` function to give us the map limits
84+
85+
\begin{examplefig}{}
86+
```julia
87+
using GMT
88+
89+
# Get the geographical limits of the Big Island in Hawaii
90+
D = geocoder("Hawaii, Island");
91+
92+
# Get the image tiles of the Big Island in Hawaii using the Bing provider and automatic zoom level
93+
I = mosaic(D, bbox=true);
94+
95+
viz(I)
96+
```
97+
\end{examplefig}
98+
99+
100+
See Also
101+
--------
102+
103+
\myreflink{geocoder}

documentation/utilities/rasterzones.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
rasterzones!(GI::GItype, shapes::Vector{GMTdataset}, fun::Function)
55
```
66

7-
*keywords: GMT, Julia, zonal statistical*
7+
*keywords: GMT, Julia, zonal statistics*
88

99
Apply a unidimensional function `fun` to to the elements of the grid or image `GI` that lies inside the polygons
1010
of the \myreflink{GMTdataset} `shapes`. The `GI` array is modified in place.

gallery/ex25.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ coast!(shore=:thinnest, area=500)
6161
# Place an explanatory legend below
6262
legend!(pos=(anchor=:BC, width=10), box=(pen=:thick,), yshift=-1.0, par=(:FONT_ANNOT_PRIMARY,7),
6363
text_record(["N 3"
64-
string("S 0.3 s 0.25 red 0.25p 0.5 Terrestrial Antipodes [", land.data[1], " %]", )
65-
string("S 0.3 s 0.25 blue 0.25p 0.5 Oceanic Antipodes [", ocean.data[1], " %]", )
66-
string("S 0.3 s 0.25 gray 0.25p 0.5 Mixed Antipodes [", mixed.data[1], " %]", )]), show=true)
64+
string("S 0.3 s 0.25 red 0.25p 0.5 Terrestrial Antipodes [", round(Int, land.data[1]), " %]", )
65+
string("S 0.3 s 0.25 blue 0.25p 0.5 Oceanic Antipodes [", round(Int, ocean.data[1]), " %]", )
66+
string("S 0.3 s 0.25 gray 0.25p 0.5 Mixed Antipodes [", round(Int, mixed.data[1]), " %]", )]), show=true)
6767
```
6868
\end{examplefig}

0 commit comments

Comments
 (0)