On Thu, 9 Jan 2020, Ben Tupper wrote:

Your assignments that look like...

minx <-  rain_data_UTM at bbox[1,1]

are not valid R statements - and that will cause an error.

I think that this might be the mail or some other system replacing commercial at by at. Better syntax might be:

minx <-  slot(rain_data_UTM, "bbox")[1,1]

if this was the real intention, as slot() is the preferred script-level S4 slot accessor, although one finds lots of untidy examples using commercial at in blogs and elsewhere on the net. However, your version is obviously much easier to read:

Instead,
obtain a matrix of the bounding box using the bbox() function.  Then
extract your coordinates from that. I think you want...

bb <- bbox(rain_data_UTM)
minx <- bb[1,1]
maxx <- bb[1,2]
miny <- bb[2,1]
maxy <- bb[2,2]

And yes, this is very good advice!

Roger


If you haven't seen this, https://www.rspatial.org/ , it is well worth your
time.  There are a lot of other great resources about using spatial data in
R.  Try searching the Rseek.org. Like this
https://rseek.org/?q=spatial+tutorials  It is a gold mine.


On Thu, Jan 9, 2020 at 1:42 PM Bakary Faty <bakaryf...@gmail.com> wrote:

Thank you for appreciated reply,

I explane you exactly what I want to do with this R code attached.
I want to adapt this code to my data to build an isohyet map.
But i have some difficulties to adapt it to my case.
I will be very happy when you will help my to adapt this R code (attached)
to my case.
You can find attached the you R code, my data file and my sahefile of
watershed.

Best regards


Le jeu. 9 janv. 2020 à 17:47, Ben Tupper <btup...@bigelow.org> a écrit :

Welcome to r-sig-geo!

I don't think that you haven't provided us enough information so that we
can help.  On the other hand, does the example below using expand.grid help?

minx <- 20
maxx <- 25
miny <- 31
maxy <- 36
pixel <- 1
grd <- expand.grid(x = seq(minx, maxx, by=pixel), y = seq(miny, maxy,
by=pixel))

Ben

On Thu, Jan 9, 2020 at 11:41 AM Bakary Faty <bakaryf...@gmail.com> wrote:


Dear,

I'm writing to express my wish to join R-sig-geo list users.
I was doing a search on the net to know how to build an isohyet map and
I came across this R code.
However, I stumbled upon a problem from the line :
grd <- expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy,
by=pixel)),
I get the following error message:
default method not implemented for type 'S4'. I want to know how resolve
this error.

Also, I would like to ask you only at the line level:
minx <- rain_data_UTM at bbox[1,1]
maxx <- rain_data_UTM at bbox[1,2]
miny <- rain_data_UTM at bbox[2,1]
maxy <- rain_data_UTM at bbox[2,2],
if I should limit myself to "rain_data_UTM" or write completely:
rain_data_UTM at bbox[,].
 By the way, this is the pointfile I reconstructed.
You can find it attached to the mail.

Thanks in advance

Best regards



Bakary
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
http://www.bigelow.org/
https://eco.bigelow.org



--



Bakary





--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to