A circle on the sphere as a GeoJSON Polygon: d3-geo's geoCircle (spec/09 §5,
visualize #525, D-131), copied from visualize's Visualize.Geo.Circle.
polygon/1 returns the small circle of angular radius degrees about center, as
%{"type" => "Polygon", "coordinates" => [ring]}, one ring of [lon, lat] positions in
degrees. The ring is d3-geo 3.1.1's, point for point and in d3's order and winding, so
Macaw.Draw.Geo.Path, which clips on the sphere as d3 does (visualize spec/07 §2.2.1, D-127), fills
the cap of radius about center under every projection — a hemisphere at 90°.
iex> {:ok, %{"type" => "Polygon", "coordinates" => [ring]}} =
...> Macaw.Draw.Geo.Circle.polygon(center: [0, 0], radius: 10, precision: 90)
iex> length(ring)
5The ring starts at the circle's angle radius about its axis, not at its southernmost
point, and runs every precision degrees back round to it, as d3's does.
Options, checked at once, by atom or string key:
:center—[lon, lat]in degrees (default[0, 0]):radius— the angular radius in degrees, taken as given (default90):precision— the step between the ring's points, in degrees of the circle's own angle (default6);0gives an empty ring, as in d3; a negative one, on which d3's loop never ends, is{[:precision], {:type, :non_negative_number}}
Summary
Functions
The circle of radius degrees about center, every precision degrees, as a GeoJSON
Polygon (visualize spec/07 §2.5).
Types
Functions
@spec polygon(keyword() | map()) :: {:ok, t()} | {:error, [Macaw.Base.Fault.t()]}
The circle of radius degrees about center, every precision degrees, as a GeoJSON
Polygon (visualize spec/07 §2.5).