Open Maschette opened 2 years ago
what if you do
sf::sf_use_s2(FALSE)
then run again? We should bake that into the package
Yep that fixes it. although in this particular instance the crop king of fucks up by drawing a line across 60 degrees, which I think is the peninsulas fault
library(SOmap)
#> Loading required package: raster
#> Loading required package: sp
library(ggplot2)
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.4.3, PROJ 7.2.1; sf_use_s2() is TRUE
sf::sf_use_s2(FALSE)
#> Spherical geometry (s2) switched off
llproj <-"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
bigmap<-SOgg(SOmap_auto(x=c(45,145), y=c(-50, -70), input_points = F, input_lines = F, target = llproj))
#> dist is assumed to be in decimal degrees (arc_degrees).
#> although coordinates are longitude/latitude, st_intersection assumes that they are planar
#> dist is assumed to be in decimal degrees (arc_degrees).
#> although coordinates are longitude/latitude, st_intersection assumes that they are planar
bigmap
stat_areas <- SOauto_crop(SOproj(SOmap_data$CCAMLR_statistical_areas, target = llproj), x = bigmap, sp = F)
#> Warning in wkt(obj): CRS object has no comment
#> Warning in wkt(obj): CRS object has no comment
#> Warning in spTransform(xSP, CRSobj, ...): NULL target CRS comment, falling back
#> to PROJ string
#> dist is assumed to be in decimal degrees (arc_degrees).
#> although coordinates are longitude/latitude, st_intersection assumes that they are planar
ggplot(data=stat_areas)+geom_sf(fill=NA)+theme_bw()
Created on 2022-09-09 with reprex v2.0.2
SOauto_crop is kind of working but also not, what should be straight lines become really jagged. It also doesn't appear to crop to the right boundary.
Created on 2022-09-09 with reprex v2.0.2