-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
coord 🗺️messagesrequests for improvements to error, warning, or feedback messagesrequests for improvements to error, warning, or feedback messages
Description
Hi, I'm using ggplot to process some geospatial data and I'm finding that setting crs
and default_crs
doesn't produce the expected results and no errors are reported.
I'm not sure if it's because I don't fully understand these two parameters or if it's something else.
crs
is supposed to determine the reference system for the final plot;default_crs
is used to specify the original reference system for the data.
In the example below, the raw data is in the epsg:4326
coordinate system, and I'm trying to show it using a different projected coordinate system, but the plotting results are blank.
I provided data that could be reproduced: example data
library(ggplot2)
library(sf)
data <- read.csv('./example.csv', row.names = 1)
targetcrs <- paste(
"+proj=lcc",
"+lat_1=25",
"+lat_2=47",
"+lon_0=105",
"+datum=WGS84",
"+units=m",
sep = " "
)
ggplot(data = data, aes(x = x, y = y))+
geom_raster(aes(fill = value))+
facet_wrap(~class)+
coord_sf(
crs = st_crs('epsg:32649'), # or crs = targetcrs,
default_crs = st_crs('epsg:4326'))

Metadata
Metadata
Assignees
Labels
coord 🗺️messagesrequests for improvements to error, warning, or feedback messagesrequests for improvements to error, warning, or feedback messages