1

Using the global coral reef distribution data provided by UNEP https://data.unep-wcmc.org/datasets/1

I have been attempting to buffer around the points and polygons of coral reefs. The point buffers (green) seem to be fine, however the polygon buffers (pink) are seemingly spread across the world.

I was wondering if there is a technique to clean up the buffers that spread across the world? Or is there geometries with the data that is causing this to happen? I am not sure I am asking the right question here.

Here is my code for the multi polygon data, which I replicated for the point data:

##projection,

c_py <- st_transform(c_py, crs = "+proj=laea +lat_0=45.5 +lon_0=-114.125 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs")

##buffers 100km

buffer_100_py <- st_buffer(c_py, dist = 100000)

After which I printed a map using tmap package, where you can see the buffers in pink spread across the whole map.

enter image description here

Here is the buffers after st_union, if this may reveal better what behaviour is going on here?

enter image description here

I am new to spatial data, and was wondering if there was something simple I was missing?

Update:

In an attempt to correct for the buffers crossing the dateline I applied this code to use the st_wrap_dateline function.

buffer_100_py2 <- buffer_100_py %>% st_wrap_dateline(options = c("WRAPDATELINE=YES",  "DATELINEOFFSET=180"), quiet = TRUE)

Note here is just polygon buffer, point buffer excluded

So can see the function hasn't worked as I expected.

  • It's because some of your buffer cross the 180° line, you'll find quite a few question about this on this site – J.R Aug 29 '19 at 11:29
  • Ah ok. So this is resolved through reprojection? I am hoping to use the buffers to carry out data extraction from rasters, but worried that this will affect the results somehow? – Asw Aug 29 '19 at 11:44
  • Have a look at this question : gis.stackexchange.com/questions/72621/… You may find answer that suit you – J.R Aug 29 '19 at 12:18
  • Thanks. I have been looking through some of these answers, I think a solution could to be re-center the world map. I have only however, seen solutions for this using ggplot and maps packages. I was wondering if this could be done in tmap package? – Asw Sep 3 '19 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.