Work with rectangular map areas (polygons) defined by two corners and an optional rotation.
This module provides a simplified interface for creating and using rectangular areas on a map. It wraps the internal polygon logic and exposes a clean public API.
Represents the style of an area, including fill color and optional border.
Create a rectangular area from a top-left and bottom-right coordinate, with a rotation in degrees (clockwise, around the center of the rectangle).
import Maps.Area
import Maps.Geo exposing (latLng)
myArea =
Maps.Area.create
-- top-left
(latLng 52.52 13.38)
-- bottom-right
(latLng 52.51 13.39)
-- rotation in degrees
30Set the rotation of an area in degrees (clockwise, around the center of the rectangle).
import Maps.Area exposing (Area, withRotation)
myArea : Area
myArea =
Maps.Area.create
(Maps.Geo.latLng 52.52 13.38)
(Maps.Geo.latLng 52.51 13.39)
|> withRotation 45Set the border of an area with a specified width and color.
import Maps.Area exposing (Area, withBorder)
myArea : Area
myArea =
Maps.Area.create
(Maps.Geo.latLng 52.52 13.38)
(Maps.Geo.latLng 52.51 13.39)
|> withBorder { width = 2, color = "blue" }Set the fill color of an area.
import Maps.Area exposing (Area, withFill)
myArea : Area
myArea =
Maps.Area.create
(Maps.Geo.latLng 52.52 13.38)
(Maps.Geo.latLng 52.51 13.39)
|> withFill "rgba(0, 128, 255, 0.4)"
Represents a rectangular polygonal area on the map.