Releases: openair-project/openairmaps
openairmaps 0.9.1
New features
-
Pairwise statistics (e.g.,
"robust_slope"
) are now supported bypolarMap()
. (#72) -
The
polarMap()
family has gained theprogress
argument, allowing users to switch the progress bar on and off. -
trajMapStatic()
has gained thesize
andlinewidth
arguments, which directly map onto the arguments inggplot2::geom_point()
andggplot2::geom_path()
, respectively. These can either be a column of the data (likecolour
), or can be an absolute value (e.g.,2L
). Note that, by default,linewidth
takes the value ofsize
, but both can be set independently.
Bug fixes
-
Vectors greater than length 1 passed to
popup
in thepolarMap()
argument will no longer error whentype = NULL
. -
...
will successfully pass toopenair::cutData()
in thepolarMap()
andtrajMap()
families of functions. -
The default
diffMap()
colour scale will no longer appear inverted compared toopenair::polarDiff()
. -
Fixed an issue in which
quickTextHTML()
would incorrectly format non breaking spaces when doing, e.g.,quickTextHTML("ug/m3")
. -
The order in which
trajMapStatic()
draws points and paths has been tweaked, which should ensure that markers are drawn on top of their respective path, rather than on top of all paths. -
buildPopup()
will now work correctly if notype
is provided.
openairmaps 0.9.0
Breaking changes
-
BREAKING: The
polarMapStatic()
family is now powered by{ggspatial}
rather than{ggmap}
as it does not require an API key. This means theggmap
argument has been removed and theprovider
argument has been added. Other benefits of this switch include a greater number of available base maps (see:rosm::osm.types()
) and the ability to simply change the extent of the map axes usingggplot2::coord_sf()
. (#52) -
BREAKING: The
control
andfacet
arguments have been deprecated in favour oftype
in all functions. These arguments will eventually be removed, but as of this version of{openairmaps}
users will be warned away from their use. This brings{openairmaps}
in-line with the{openair}
package. -
BREAKING: The
names
andcols
arguments ofbuildPopup()
have been coalesced into a singlecolumns
argument for less verbose function usage. -
BREAKING: The
collapse.control
argument has been renamed tocontrol.collapsed
and thedraw.legend
argument tolegend
. This is to allow these options to sit more nicely with their new argument family members -legend.title
,legend.title.autotext
,legend.position
, and so on.
New features
-
The
polarMapStatic()
family of functions have been combined with thepolarMap()
family, with static maps available to be accessed using thestatic
argument. (#59) ThepolarMapStatic()
family are therefore deprecated, and will later be removed from{openairmaps}
. The justification for this is as follows:-
The combined functions allows for a more simple, consistent API for users (e.g., avoiding needing to switch between
facet
andcontrol
). -
The use of the
static
argument allows for simple switching between dynamic and static maps. For example, a researcher may wish to use the dynamic maps for data exploration, but then switch to a static map for placement into a PDF report. -
Recent developments have meant that the arguments and capability of these functions have started to align regardless (e.g.,
provider
,crs
). -
Combining these functions has reduced repetition in the source code of
{openairmaps}
, reducing the likelihood of oversights and bugs, and allowing for more rapid development.
-
-
The
crs
argument has been added to thepolarMap()
andpolarMapStatic()
families and tosearchNetwork()
. This argument allows for users to specify that their data is using an alternative coordinate system to the standard longitude/latitude (e.g., the British National Grid CRS). Alternate CRS will be re-projected to longitude/latitude for plotting as this is expected by{leaflet}
/{ggspatial}
. (#56) -
Users now have greater control over the positions of legends and layer control menus, and the titles of legends, throughout
{openairmaps}
functions, including thepolarMap()
family,trajMap()
family, andnetworkMap()
. -
Popups for the dynamic
polarMap()
family will now be near the top of the plot rather than the centre. This will obscure less of the plot itself while the marker is visible. (#55) -
quickTextHTML()
's lookup table has gained new pollutants and units, and ignores the input case oftext
more consistently. -
Two examples of the use of
{openairmaps}
with{shiny}
have been added to the package. Runshiny::runExample(package = "openairmaps")
to view these. (#60)
Bug fixes
-
Legends drawn by the
polarMapStatic()
function should now render using more recent versions of{ggplot2}
. -
The
addTrajPaths()
layerId
argument is now implemented in a sensible way to ensure each geometry has a uniquelayerId
and can therefore be interacted with in a{shiny}
context.layerId
is now the base on which the actual layerId is built, with each real layerId in the form BASE-LN-PN where LN is the line number and PN is the point number. For example, iflayerId = "traj"
, the first point of the first line has the ID"traj-1-1"
, the second point of the first line has ID"traj-1-2"
, the first point of the second line has ID"traj-2-1"
, and so on.
-
"illegal" file path characters can now be used in the columns provided to the
type
argument of thepolarMap()
family. Most relevant to most users is that this will allow them to provide their own custom HTML tags - e.g., for formatting superscripts, subscripts, and so on. (#63) -
The colours in the legend of
networkMap()
now better align with the actual colours of the markers, and the layer control menu whencontrol = "variable"
is now presented in a nicer order with clearer labels.
openairmaps 0.8.1
These are items associated with the development version of {openairmaps}
.
Breaking changes
-
BREAKING: The arguments of
addPolarMarkers()
have been rejigged to move "data" after "pollutant", owing to the new use ofleaflet::getMapData()
. (#45) -
BREAKING: The default arguments of some
polarMap()
-family functions have changed from, e.g.,NULL
to"free"
or"fixed"
. (#34) -
BREAKING: Due to changes in
{ggmap}
, all static polar plotting functions now require users to provide their ownggmap
object. Thezoom
argument has also been removed. This is specifically related to the partnership of Stamen and Stadia which has put the stamen tiles behind an API. See https://maps.stamen.com/stadia-partnership/ and dkahle/ggmap#353 for more information. (#52)
New features
-
Several "limit" arguments can now take one of three options: "fixed" (which forces all markers to share scales), "free" (which allows them to use different scales), or a numeric vector to define the scales. (#34) These arguments and their defaults include:
polarMap()
:upper
(fixed);limits
(free)annulusMap()
:limits
(free)freqMap()
:breaks
(free)percentileMap()
:intervals
(fixed)
-
Added
searchNetwork()
, which allows users to find local air quality monitoring sites by specifying a target latitude and longitude. Function arguments allow the site metadata to be subset (for example, by site type, pollutants measured, or distance from the target). -
Added
convertPostcode()
, which converts a valid UK postcode to a latitude/longitude pair. This is intended to be used withsearchNetwork()
. -
The "data" argument of
addPolarMarkers()
andaddTrajPaths()
and both the "before" and "after" arguments ofaddPolarDiffMarkers()
now default toleaflet::getMapData(map)
. This makes their use less verbose when creating multiple polar plots with the same underlying data, which will likely be a common use-case. (#45) -
networkMap()
popups now contain links to the associated network websites. For example, the popup for London Marylebone Road innetworkMap("aurn")
now contains a link to https://uk-air.defra.gov.uk/networks/site-info?site_id=MY1. All networks are supported with the exception of "europe". (#39) -
addPolarMarkers()
andaddPolarDiffMarkers()
now have all of the "options" arguments ofleaflet::addMarkers()
. This means that, for example, polar markers can be clustered (https://leafletjs.com/reference.html#marker). (#38) -
The
polarMap()
family andnetworkMap()
provider
argument can now take a named vector. The names will be used in the layer control menu, iflength(provider) > 1
. (#42)
v0.8.0
openairmaps 0.8.0
This is a minor release adding a range of quality of life features, adding two new experimental functions, and fixing a few bugs.
New features
-
trajMapStatic()
andtrajLevelMapStatic()
have been added as two new experimental functions to provide{ggplot2}
equivalents ofopenair::trajPlot()
andopenair::trajLevel()
.- These are experimental as the long term place for these functions is uncertain; there will definitely be need for a
{ggplot2}
incarnation of the trajectory plotting functions, but whether they will sit in{openair}
,{ggopenair}
or{openairmaps}
and what they will be named is not clear.
- These are experimental as the long term place for these functions is uncertain; there will definitely be need for a
-
The
control
andfacet
arguments of all polar marker mapping functions (static and interactive) and trajectory mapping functions are now passed toopenair::cutData()
. -
The
popup
argument of all interactive polar marker mapping functions can now take a vector of column names. If more than one column is provided, it is automatically passed tobuildPopup()
using its default values. -
trajLevelMap()
now has thecontrol
argument, which maps directly onto thetype
argument ofopenair::trajLevel()
. Like othercontrol
arguments elsewhere in{openairmaps}
, this creates a "layer control" menu. -
networkMap()
now uses different coloured markers for different networks. If more than one network is specified, anddraw.legend
is set toTRUE
, a legend will also be drawn for quick identification of different data sources. -
Deprecations are now managed by the
{lifecycle}
package. This currently only applies to thetype
argument.
Bug fixes
-
Fixed issues where multiple
addPolarMarkers()
chained together would all show the same plot. -
Fixed issue where
...
andpollutant
weren't being passed toaddPolarMarkers()
. -
Fixed issue in
trajMap()
caused by recent updates to{dplyr}
and{forcats}
. -
Fixed issue where
polarMapStatic()
and others would turn factor facet levels into characters. -
Fixed issue where
polarMapStatic()
and others would error when trying to draw a legend.
v0.7.0
openairmaps 0.7.0
-
Added "static" equivalents of all of the polar marker maps written in
{ggplot2}
. While interactive HTML maps are preferred, the static equivalents may be more appropriate for, e.g., academic publications.-
The
{ggplot2}
functions can be identified by "Static" being appended to the function name. For example,polarMap()
is the{leaflet}
polar plot map, whereaspolarMapStatic()
is the{ggplot2}
equivalent. -
Currently, "static" versions of the trajectory maps are served by
openair::trajPlot()
andopenair::trajLevel()
, but there may be space in future to haveggmap
equivalents of these inopenairmaps
.
-
-
Added
diffMap()
anddiffMapStatic()
which are toopenair::polarDiff()
whatpolarMap()
andpolarMapStatic()
are toopenair::polarPlot()
. Also addedaddPolarDiffMarkers()
, which is the equivalent ofaddPolarMarkers()
. -
Added
alpha
as an argument to all of the directional analysis polar mapping functions, not justpolarMap()
. -
Fixed
alpha
to work on both Windows and MacOS by forcing the use of the "cairo" device to save plots. -
Polar marker maps and
addPolarMarkers()
now show a progress bar when creating the markers takes more than a few seconds (most commonly inpolarMap()
andannulusMap()
, particularly with multiple pollutants/control groups). -
networkMap()
can now pass the newyear
option toimportMeta()
. -
BREAKING: The
fig.width
,fig.height
,iconHeight
andiconWidth
arguments have been replaced withd.fig
andd.icon
. There are two main justifications behind this:-
This ensures consistency across all of
{openairmaps}
, making it easier to switch between the static and HTML map types. -
Polar markers are almost always going to be circular (i.e., width = height) so having one argument will streamline things. If users wish to have non-circular markers, a vector of length two in the form
c(width, height)
will provide the same functionality.
-
-
BREAKING: The arguments in
addPolarMarkers()
have been put in a more sensible order, leading withdata
,pollutant
andfun
. -
BREAKING: The
date
argument fromnetworkMap()
has been replaced byyear
.
v0.6.1
openairmaps 0.6.1
Fixed issue with polar marker maps (e.g., polarMap()) and the generic addPolarMarkers() function where lat/lon info in the Southern Hemisphere would misalign markers. Hat tip to Deanna Tuxford and James/"@jenright-git" for noticing this issue.
Fixed an issue with networkMap() where control = "variable" would fail to show all pollutants.
Functions now use Google's "turbo" colour palette rather than "jet" by default. More about this palette and the advantages of using it over "jet" can be read at https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html.
v0.6.0
Directional Analysis
-
All directional analysis maps can now have their limits provided (can be "limits", "breaks", "percentiles", etc., depending on function). This was always possible through
...
, but it is now explicitly listed as an option. -
If limits are defined in a directional analysis function, a shared legend will now be drawn at the top-right of the map. This functionality can be disabled by setting
draw.legend
to FALSE. -
Added the
buildPopup()
function, which allows users to easily construct HTML popups for use with the "popup" argument of directional analysis maps (orleaflet
maps more widely). -
All directional analysis maps now possess the
collapse.control
argument, which controls whether the control menu starts collapsed or not. It defaults toFALSE
, which means the control menu is not collapsed. -
The default options for fig.width and fig.height are now
3.5
rather than4
. This appears to remove some visual artefacts and makes the axis labels more legible. -
The "alpha" option has been removed for all directional analysis functions except
polarMap()
as it only ever worked forpolarMap()
. -
All documentation has been improved; function parameters are more consistent between functions and arguments passed to
openair
via...
are now explicitly listed.
Network Visualisation
-
networkMap()
now supports multiple sources. For example, usingsource = c("aurn", "saqn")
will show both the AURN and SAQN on one map. This may be useful if users are interested in air quality in a specific region of the UK (e.g., users may wish to locate AURN, AQE and locally managed sites near to a given urban centre). -
networkMap()
now supportssource = "local"
. -
Multiple basemap providers can now be used with
networkMap()
. -
networkMap()
has gained thecollapse.control
argument.
Trajectory Analysis
trajMap()
has gained thecollapse.control
argument.
v0.5.1
Hot-fix for a potentially serious bug in v0.5.0
which caused markers to duplicate when sites didn't measure certain pollutants.
v0.5.0
openairmaps 0.5.0
Directional Analysis
-
All functions now possess the "control" argument, which allows users to create a "layer control" menu with any arbitrary column. Appropriate columns may be those produced using
openair::cutData()
,openair::splitByDate()
, or a user-defineddplyr::case_when()
/dplyr::if_else()
column transformation. -
All functions now possess the "popup" and "label" arguments, which control pop-up and hover-over labels, respectively. This allows users to define any popup or label column, even non-unique ones. For example, multiple sites can be labelled with identical site types.
-
All functions now try to guess the latitude/longitude column if not provided, similar to
{leaflet}
. -
BREAKING: All functions now use latitude and longitude to distinguish between site types. Therefore, "type" is now deprecated. Maps using the old system will still render, but popups will not be displayed. For most users, to restore previous site labels simply rewrite
type = "site"
aspopup = "site"
. -
BREAKING: The default values for "pollutant" have all been removed. Any users relying on this default should update their code to explicitly state
pollutant = "nox"
.
Trajectory Analysis
-
Allowed
trajMap()
to be coloured by date. -
FIX: Fixed issue with
trajMap()
that would cause user-defined colours not to work.
Other
- Updated many error messages and warnings to use
{cli}
and be broadly more descriptive.