Check coordinate system

Stijn Van Hoey

2017-12-08

Introduction

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.

Aim

The aim is to quickly check the coordinate system by plotting the coordinates on a leaflet map with a list of given coordinate systems.

Functionality

Dependencies

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)

Projection function

The guess_projection function requires as minimal inputs:

  1. a data.frame
  2. the longitude column name
  3. the latitude column name.

For 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:

Which 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.