Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205301

Gaps in RasterLayer using R

$
0
0

I have this shapefile, from where I took the first two columns (left and top) to acess another database and get values of elevation.

Simple feature collection with 959 features and 5 fields
geometry type:  MULTIPOINT
dimension:      XY
bbox:           xmin: -50.49206 ymin: -15.00123 xmax: -41.99206 ymax: -2.501234
epsg (SRID):    NA
proj4string:    +proj=longlat +ellps=GRS80 +no_defs
# A tibble: 959 x 6
    left   top right bottom    id              geometry
   <dbl> <dbl> <dbl>  <dbl> <dbl>      <MULTIPOINT [°]>
 1 -48.0 -7.50 -47.7  -7.25   605 (-47.99206 -7.501234)
 2 -48.0 -7.75 -47.7  -7.50   606 (-47.99206 -7.751234)
 3 -48.0 -8.00 -47.7  -7.75   607 (-47.99206 -8.001234)
 4 -48.0 -8.25 -47.7  -8.00   608 (-47.99206 -8.251234)
 5 -48.0 -8.50 -47.7  -8.25   609 (-47.99206 -8.501234)
 6 -48.0 -8.75 -47.7  -8.50   610 (-47.99206 -8.751234)
 7 -48.0 -9.00 -47.7  -8.75   611 (-47.99206 -9.001234)
 8 -48.0 -9.25 -47.7  -9.00   612 (-47.99206 -9.251234)
 9 -48.0 -9.50 -47.7  -9.25   613 (-47.99206 -9.501234)
10 -48.0 -9.75 -47.7  -9.50   614 (-47.99206 -9.751234)
# ... with 949 more rows

Here the plot of the shapefile:

I accessed the database and wrote a netCDF file (StackOverflow Question). I used the same 959 geo points.

class      : RasterLayer 
dimensions : 51, 35, 1785  (nrow, ncol, ncell)
resolution : 0.25, 0.25  (x, y)
extent     : -50.61706, -41.86706, -15.12623, -2.376234  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
source     : D:/2019/Projetos/Dados_Xavier/Xavier/elev.nc 
names      : elev 
zvar       : elev

However, when I plot with plot(RasterLayer) i get this:

The plot of the RasterLayer

Why the plot of the raster have this gaps, and why don't have the same shape as the shapefile plot?


Viewing all articles
Browse latest Browse all 205301

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>