Skip to contents

The function coords_to_google can be used to convert coordinates of an sf object to a format that is easy to copy and paste into Google Maps.

Usage

coords_to_google(coords, crs_out = 25833)

Arguments

coords

An sf object with a geometry column that will be converted to CRS 4326.

crs_out

Chosen coordinate reference system (CRS) for the geometry column of the returned sf object.

Value

An sf object with a new column added (coords_google), and an addtional sf geometry column with the chosen CRS.

Examples

address_to_coords(zip_code = "0185", address = "Schweigaards gate 10") %>%
  coords_to_google()
#> Simple feature collection with 1 feature and 6 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 262876.8 ymin: 6649176 xmax: 262876.8 ymax: 6649176
#> Projected CRS: ETRS89 / UTM zone 33N
#>                   address zip_code kommunenummer kommunenavn ID
#> 0185 Schweigaards gate 10     0185          0301        OSLO  1
#>                          coords_google                 geometry
#> 0185 59.911683292289, 10.7581478621495 POINT (262876.8 6649176)