The graticule, d3-geo's geoGraticule: meridians, parallels and their outline as
GeoJSON that Macaw.Draw.Geo.Path clips and projects like any geometry (spec/09 §6).
visualize had none; this is a port of d3-geo's src/graticule.js.
iex> {:ok, g} = Macaw.Draw.Geo.Graticule.new()
iex> g |> Macaw.Draw.Geo.Graticule.lines() |> length()
53Every line is sampled every precision degrees, meridians as well as parallels: d3
samples a meridian every 90° and leaves the curve to its stream's adaptive resampling,
which Macaw.Draw does not have, so a meridian under a conic or an azimuthal projection
curves as it should here (decision 3).
Summary
Functions
One LineString per line (spec/09 §6.2): the major meridians, the major parallels, the
minor meridians not on a major one, and the minor parallels not on a major one, in that
order.
Every line as one MultiLineString: d3's graticule().
A graticule, its options checked at once (spec/09 §6.1): extent_major, extent_minor
([[lon0, lat0], [lon1, lat1]], the first corner below and west of the second, else
{[key], :inverted}), step_major, step_minor ([dlon, dlat] of positive numbers)
and precision (positive, 2.5). extent sets both extents and step the minor step,
as d3's extent and step do; a key naming one of them alone wins over it.
The Polygon bounding the major extent: the meridian at its west edge up, the parallel
at its north edge east, the meridian at its east edge down and the parallel at its south
edge west, each sampled at precision, shared corners once.
The defaults' multi_line/1: d3's geoGraticule10.
Types
Functions
@spec lines(t()) :: [geometry()] | {:error, [Macaw.Base.Fault.t()]}
One LineString per line (spec/09 §6.2): the major meridians, the major parallels, the
minor meridians not on a major one, and the minor parallels not on a major one, in that
order.
@spec multi_line(t()) :: geometry() | {:error, [Macaw.Base.Fault.t()]}
Every line as one MultiLineString: d3's graticule().
@spec new(keyword() | map()) :: {:ok, t()} | {:error, [Macaw.Base.Fault.t()]}
A graticule, its options checked at once (spec/09 §6.1): extent_major, extent_minor
([[lon0, lat0], [lon1, lat1]], the first corner below and west of the second, else
{[key], :inverted}), step_major, step_minor ([dlon, dlat] of positive numbers)
and precision (positive, 2.5). extent sets both extents and step the minor step,
as d3's extent and step do; a key naming one of them alone wins over it.
@spec outline(t()) :: geometry() | {:error, [Macaw.Base.Fault.t()]}
The Polygon bounding the major extent: the meridian at its west edge up, the parallel
at its north edge east, the meridian at its east edge down and the parallel at its south
edge west, each sampled at precision, shared corners once.
@spec ten() :: geometry()
The defaults' multi_line/1: d3's geoGraticule10.