The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This vignette covers the spatial analysis utilities in pkmapr, including centroids, buffers, distance calculations, point-in-polygon assignment, boundary dissolving, and coordinate reference system selection.
pk_centroid() converts polygon geometries to points,
useful for labelling and distance calculations:
pk_buffer() creates buffer zones around administrative
units. Distances are specified in kilometres:
pk_distance() computes centroid-to-centroid distances
between two sf objects, returning a distance matrix:
pk_points_in() assigns GPS point locations to the
administrative unit they fall within:
facilities <- data.frame(
name = c("Hospital A", "Clinic B"),
lon = c(74.3, 74.5),
lat = c(31.5, 31.6)
) |>
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326)
facilities_with_district <- pk_points_in(facilities, districts)
facilities_with_district |>
sf::st_drop_geometry() |>
select(name, district_name)pk_union() aggregates finer administrative units to a
coarser level by dissolving shared boundaries:
pkmapr returns data in WGS84 (EPSG:4326) by default, which measures
in degrees. For metric operations such as area, buffer, and distance
calculations, a projected CRS is required. Use
pk_crs_suggest() to get a recommended CRS for your data’s
spatial extent, then reproject with pk_project():
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.