When retrieving a number of data-points, but the kind of projection is not provided/known (for any reason), the guess_projection function plots the data for different projections on a map to make comparison possible. The main function is guess_projection which creates the map with different options. The reproject_points function can be useful as well, as it supports reprojection of coordinate columns in a data.frame.
The aim is to quickly check the coordinate system by plotting the coordinates on a leaflet map with a list of given coordinate systems.
In order to run the functionalities, some R packags need to be installed. The set of required libraries is handled by the inborutils package itself.
Loading the functionality can be done by loading the inborutils package:
library(inborutils)The guess_projection function requires as minimal inputs:
data.frameFor example:
# my_dataframe has the columns "longitude" and "latitude"
guess_projection(coordinate_example, "longitude", "latitude")Furthermore, the optional argument belgium is a boolean value (TRUE/FALSE) defining if the data is expectd to be in Belgium. Finally, the epsg codes of the corresponding coordinate systems to check can be customised.
By default, the following CRS-systems are tested:
epsg:4326epsg:31370epsg:28992epsg:32631epsg:3812epsg:3035Which can be overridden by adapting the projections argument:
guess_projection(coordinate_example, "longitude", "latitude", belgium = TRUE,
projections = c("epsg:2000", "epsg:2805", "epsg:4326"))Check the spatial reference for the available codes.