Plot a raster behind a shapefile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Plot a raster behind a shapefile

Stefano Sofia
Dear  list users,
I need to plot a raster behind a shapefile. Both the raster and the shapefile have been built correctly, I checked it.

I created a raster called rain_rast through the command

rain_rast <- raster(OK_rain$krige_output)

with the characteristics here reported
# output:
#class       : RasterLayer
#dimensions  : 151, 125, 18875  (nrow, ncol, ncell)
#resolution  : 1000, 1000  (x, y)
#extent      : 284845.9, 409845.9, 4712479, 4863479  (xmin, xmax, ymin, ymax)
#coord. ref. : +init=epsg:32633 +proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
#data source : in memory
#names       : var1.pred
#values      : 0.8162388, 46.54594  (min, max)

and I loaded a shapefile  called Marche_shape through the command

Marche_shape <- readOGR(dsn="Shapefile_regione_Marche", layer="Lim_reg_2012_wgs32633")

which is a shapefile with reference system EPSG:32633 - WGS 84 / UTM zone 33N and a unique layer called Lim_reg_2012_wgs32633.

Could somebody show me how to plot the raster behind the shapefile? (plot alone does not work, I tried with gplot but with no success).
Maybe gglopt2? I tried to study some examples found in the web, but again I could not let them work for me.

Thank you for your help
Stefano



         (oo)
--oOO--( )--OOo----------------
Stefano Sofia PhD
Area Meteorologica e  Area nivologica - Centro Funzionale
Servizio Protezione Civile - Regione Marche
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: [hidden email]
---Oo---------oO----------------

________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Plot a raster behind a shapefile

marcia
Hi,
Have you tried this?

plot(rain_rast)
plot(Marche_shape, add = TRUE)

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Plot a raster behind a shapefile

Flo Betz
In reply to this post by Stefano Sofia
You can try the following:

plot(rain_rast)
plot(Marche_shape, add=TRUE)

Good luck!

Flo

Am 25.01.2018 um 09:55 schrieb Stefano Sofia:

> Dear  list users,
> I need to plot a raster behind a shapefile. Both the raster and the shapefile have been built correctly, I checked it.
>
> I created a raster called rain_rast through the command
>
> rain_rast <- raster(OK_rain$krige_output)
>
> with the characteristics here reported
> # output:
> #class       : RasterLayer
> #dimensions  : 151, 125, 18875  (nrow, ncol, ncell)
> #resolution  : 1000, 1000  (x, y)
> #extent      : 284845.9, 409845.9, 4712479, 4863479  (xmin, xmax, ymin, ymax)
> #coord. ref. : +init=epsg:32633 +proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
> #data source : in memory
> #names       : var1.pred
> #values      : 0.8162388, 46.54594  (min, max)
>
> and I loaded a shapefile  called Marche_shape through the command
>
> Marche_shape <- readOGR(dsn="Shapefile_regione_Marche", layer="Lim_reg_2012_wgs32633")
>
> which is a shapefile with reference system EPSG:32633 - WGS 84 / UTM zone 33N and a unique layer called Lim_reg_2012_wgs32633.
>
> Could somebody show me how to plot the raster behind the shapefile? (plot alone does not work, I tried with gplot but with no success).
> Maybe gglopt2? I tried to study some examples found in the web, but again I could not let them work for me.
>
> Thank you for your help
> Stefano
>
>
>
>           (oo)
> --oOO--( )--OOo----------------
> Stefano Sofia PhD
> Area Meteorologica e  Area nivologica - Centro Funzionale
> Servizio Protezione Civile - Regione Marche
> Via del Colle Ameno 5
> 60126 Torrette di Ancona, Ancona
> Uff: 071 806 7743
> E-mail: [hidden email]
> ---Oo---------oO----------------
>
> ________________________________
>
> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

--
Florian Betz
Gartenstraße 13
86152 Augsburg, Deutschland

Tel.: 0176 20344096
Mail: [hidden email]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo