R/shift_longitude.R
st_shift_longitude.Rd
All longitudes < 0 are added to 360, to avoid for instance parts of Alaska
being represented on the far left and right of a plot because they have
values straddling 180 degrees. In general, using a projected
coordinate reference system is to be preferred, but this method permits a
geographical coordinate reference system to be used. This is the sf
equivalent of recenter
in the sp package and
ST_ShiftLongitude in PostGIS.
st_shift_longitude(x) # S3 method for sfc st_shift_longitude(x, ...) # S3 method for sf st_shift_longitude(x, ...)
x | object of class sf or sfc |
---|---|
... | ignored |
#> Geometry set for 2 features #> geometry type: POINT #> dimension: XY #> bbox: xmin: -170 ymin: 50 xmax: 170 ymax: 50 #> CRS: NA#>#>#> Geometry set for 2 features #> geometry type: POINT #> dimension: XY #> bbox: xmin: 170 ymin: 50 xmax: 190 ymax: 50 #> CRS: EPSG:4326#>#>#> Simple feature collection with 2 features and 1 field #> geometry type: POINT #> dimension: XY #> bbox: xmin: 170 ymin: 50 xmax: 190 ymax: 50 #> CRS: EPSG:4326 #> id geometry #> 1 1 POINT (190 50) #> 2 2 POINT (170 50)