Learn R Programming

geodimension (version 1.0.2)

coordinates_to_geometry: Transform coordinates to point geometry

Description

From the coordinates defined in fields such as latitude and longitude, it returns a layer of points.

Usage

coordinates_to_geometry(table, lon_lat = NULL, crs = NULL)

Value

A sf object.

Arguments

table

A tibble object.

lon_lat

A vector, name of longitude and latitude attributes.

crs

A coordinate reference system: integer with the EPSG code, or character with proj4string.

Details

If we start from a geographic layer, it initially transforms it into a table.

The CRS of the new layer is indicated. If a CRS is not indicated, it considers the layer's CRS by default and, if it is not a layer, it considers 4326 CRS (WGS84).

See Also

Other level definition functions: check_key(), complete_point_geometry(), get_empty_geometry_instances(), get_geometry()

Examples

Run this code
us_state_point <-
  coordinates_to_geometry(layer_us_state,
                          lon_lat = c("intptlon", "intptlat"))

Run the code above in your browser using DataLab