coordinates_to_geometry | R Documentation |
From the coordinates defined in fields such as latitude and longitude, it returns a layer of points.
coordinates_to_geometry(table, lon_lat = c("intptlon", "intptlat"), crs = 4326)
table |
A |
lon_lat |
A vector, name of longitude and latitude attributes. |
crs |
A coordinate reference system: integer with the EPSG code, or character with proj4string. |
If we start from a geographic layer, it initially transforms it into a table.
The CRS of the new layer is indicated. By default, it considers 4326 (WGS84).
A sf
object.
Other geolevel definition functions:
add_geometry()
,
check_key()
,
complete_point_geometry()
,
geolevel()
,
get_empty_geometry_instances()
,
get_geometry()
layer_us_county <-
dplyr::inner_join(
get_level_data_geo(gd_us, "county"),
get_level_layer(gd_us, "county"),
by = c("geoid", "statefp", "name", "type")
) |>
sf::st_as_sf()
us_county_point <-
coordinates_to_geometry(layer_us_county,
lon_lat = c("intptlon", "intptlat"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.