Package {comorosmaps}


Type: Package
Title: Comoro Islands Maps
Version: 1.6.1
Description: Provides static and interactive maps of the Comoro Islands at four administrative levels: country, island, prefecture, and commune. Includes tools for choropleth visualisation using 'ggplot2' and 'leaflet', and functions to retrieve the underlying spatial datasets as 'sf' objects.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Depends: R (≥ 3.5)
Imports: sf, magrittr, dplyr, ggplot2, ggrepel, leaflet,
Suggests: testthat (≥ 3.0.0), readxl
Config/testthat/edition: 3
URL: https://github.com/hhousni/comorosmaps
BugReports: https://github.com/hhousni/comorosmaps/issues
NeedsCompilation: no
Packaged: 2026-06-01 13:50:59 UTC; thedreamer
Author: Housni Hassani [aut, cre]
Maintainer: Housni Hassani <housni.hassani@comoresopendata.org>
Repository: CRAN
Date/Publication: 2026-06-01 18:20:16 UTC

comorosmaps: Comoro Islands Maps

Description

A package for mapping Comoro Islands coastline and prefecture area. Data can be drawn or accessed directly as simple features objects. The package includes simple function for each Island: grandeComore(), anjouan(), moheli() and a function for the country comoros()

Author(s)

Housni Hassani happrend2@gmail.com

See Also

Useful links:


Anjouan

Description

Draw a map for Anjouan Island

Usage

anjouan(pref = FALSE, city = TRUE)

Arguments

pref

Choose to map with prefecture area ("pref" = TRUE) or without prefecture area ("pref" = FALSE)

city

Include all Anjouan cities as point features (TRUE) or exclude them (FALSE). Default is TRUE.

Value

The data set used is in sf format

Examples

## Map Anjouan Island.
anjouan ()
## Map Anjouan Island with prefecture area.
anjouan (pref = TRUE)


Comoro Islands Communes

Description

Draw a map of Comoros at the commune level (admin3).

Usage

commune(island = "all", city = FALSE)

Arguments

island

Filter by island: "grande comore", "anjouan", "moheli", or "all" (default).

city

Include capital cities as point features (TRUE) or exclude them (FALSE). Default is FALSE.

Value

The data set used is in sf format

Examples

## Map all communes
commune()
## Map only Grande Comore communes
commune(island = "grande comore")
## Map Anjouan communes with cities
commune(island = "anjouan", city = TRUE)

Comoro Islands

Description

Draw maps of Comoros Islands.

Usage

comoros(x = "country", pref = FALSE, city = FALSE)

Arguments

x

Name of the data set to use. The default is comoros(), It draws Comoro Islands as one object without commune.

pref

Choose to map with prefecture area ("pref" = TRUE) or without prefecture area ("pref" = FALSE)

city

Include all cities as point features (TRUE) or exclude them (FALSE). Default is FALSE.

Details

comoros()uses the sf package to plot by plotting the geometry rather than every column and leave the plot pref ready for overplotting with other data

Value

The data set used is in sf format

Examples

## Map Comoro Islands as one object without prefecture area
comoros()
## Map Comoro Islands as one object with prefecture area
comoros(x="country",pref=TRUE)
## Map Comoros Islands as 3 object (Grande Comore, Anjouan, Mohéli) without prefecture area.
comoros(x="island",pref=FALSE)
## Map Comoros Islands as 3 object (Grande Comore, Anjouan, Mohéli) with prefecture area
comoros(x="island",pref=TRUE)


Get city locations

Description

Returns city point features as an sf object.

Usage

get_cities(island = "all")

Arguments

island

Filter by island: "grande comore", "anjouan", "moheli", or "all" (default).

Value

An sf data frame with columns name, adminCode, and geometry.

Examples

cities <- get_cities()
moheli_cities <- get_cities(island = "moheli")

Get commune boundaries

Description

Returns commune (admin3) polygons as an sf object. Useful for custom spatial analysis, joining your own data, or exporting to GeoJSON/CSV.

Usage

get_communes(island = "all")

Arguments

island

Filter by island: "grande comore", "anjouan", "moheli", or "all" (default).

Value

An sf data frame with columns name, adminCode, and geometry.

Examples

communes <- get_communes()
anjouan_communes <- get_communes(island = "anjouan")

Get prefecture boundaries

Description

Returns prefecture (admin2) polygons as an sf object.

Usage

get_prefectures(island = "all")

Arguments

island

Filter by island: "grande comore", "anjouan", "moheli", or "all" (default).

Value

An sf data frame with columns name, adminCode, and geometry.

Examples

prefectures <- get_prefectures()
gc_prefs <- get_prefectures(island = "grande comore")

Grande Comore

Description

Draw a map for Grande Comore Island

Usage

grandeComore(pref = FALSE, city = TRUE)

Arguments

pref

Choose to map with prefecture area ("pref" = TRUE) or without prefecture area ("pref" = FALSE)

city

Include all Grande Comore cities as point features (TRUE) or exclude them (FALSE). Default is TRUE.

Value

The data set used is in sf format

Examples

## Map Grande Comore Island
grandeComore ()
## Map Grande Comore with prefecture area
grandeComore (pref = TRUE)


Moheli

Description

Draw a map for Moheli Islands

Usage

moheli(pref = FALSE, city = TRUE)

Arguments

pref

Choose to map with prefecture area ("pref" = TRUE) or without prefecture area ("pref" = FALSE)

city

Include all Mohéli cities as point features (TRUE) or exclude them (FALSE). Default is TRUE.

Value

The data set used is in sf format

Examples

## Map Moheli Island
moheli ()
## Map Moheli Island with prefecture area
moheli (pref = TRUE)

Plot a styled map of the Comoro Islands

Description

Creates a publication-ready map using ggplot2 with non-overlapping city labels via ggrepel.

Usage

plot_map(
  island = "all",
  pref = FALSE,
  commune = FALSE,
  label_regions = NULL,
  city = TRUE,
  title = NULL,
  data = NULL,
  var = NULL,
  join_by = "name",
  fill_label = NULL
)

Arguments

island

Which island to display: "all", "grande comore", "anjouan", or "moheli". Default is "all".

pref

Show prefecture boundaries (TRUE) or not (FALSE). Default FALSE.

commune

Show commune boundaries (TRUE) or not (FALSE). Default FALSE. When TRUE, overrides pref.

label_regions

Label prefecture or commune names inside their borders (TRUE) or not (FALSE). Default TRUE when pref or commune is TRUE.

city

Show city points and labels (TRUE) or not (FALSE). Default TRUE.

title

Map title. If NULL (default), a title is generated automatically.

data

Optional data frame to use for a choropleth fill. Must contain a column matching region names and a numeric column specified by var.

var

Name of the numeric column in data to use for choropleth fill.

join_by

Name of the column in data that matches the name column in the spatial data. Default is "name".

fill_label

Legend title for the choropleth scale. Defaults to the value of var.

Value

A ggplot object.

Examples

## Styled map of all islands
plot_map()
## Anjouan with prefecture names inside borders
plot_map(island = "anjouan", pref = TRUE)
## Anjouan at commune level with names
plot_map(island = "anjouan", commune = TRUE)

Interactive map of the Comoro Islands

Description

Opens an interactive leaflet map in the viewer or browser. Click polygons to see region names; hover over city markers to see city names.

Usage

view_map(
  island = "all",
  pref = FALSE,
  commune = FALSE,
  city = TRUE,
  label_regions = TRUE,
  data = NULL,
  var = NULL,
  join_by = "name",
  fill_label = NULL
)

Arguments

island

Which island to display: "all", "grande comore", "anjouan", or "moheli". Default is "all".

pref

Show prefecture boundaries (TRUE) or not (FALSE). Default FALSE.

commune

Show commune boundaries (TRUE) or not (FALSE). Default FALSE. When TRUE, overrides pref.

city

Show city markers (TRUE) or not (FALSE). Default TRUE.

label_regions

Show permanent region name labels on polygons (TRUE) or not (FALSE). Default TRUE.

data

Optional data frame to use for a choropleth fill.

var

Name of the numeric column in data for choropleth fill.

join_by

Column in data matching the region name column. Default "name".

fill_label

Legend title for the choropleth scale. Defaults to var.

Value

A leaflet map widget.

Examples

## Interactive map of all islands
## Not run: 
view_map()
view_map(island = "anjouan", commune = TRUE, city = TRUE)

## End(Not run)