Interactive maps

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Interactive maps

R help mailing list-2

 Hello, all:

   I am new here, and have a challenge to present some graphical data to the user in a convenient way.

   The challenge is to present a map to the user which is coloured with the value of a variable. Say for example, temperature. This is a preexisting graph that I can generate in any format, including svg. I don't have to produce it using R.

   When the user clicks anywhere in the map, the coordinates (longitude and latitude) have to be passed to R so that this, R, can look for the values of other variables in that location and make another graph with them.

   Does anyubody know how could I accomplish this?.

   Thanks in advance.

 

Antonio Serrano
[hidden email]
ن


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive maps

Jim Lemon-4
Hi Antonio,
If you do create the map in R, you can use locator().

Jim


On Sat, Apr 25, 2015 at 8:37 AM, Antonio Serrano via R-help
<[hidden email]> wrote:

>
>  Hello, all:
>
>    I am new here, and have a challenge to present some graphical data to the user in a convenient way.
>
>    The challenge is to present a map to the user which is coloured with the value of a variable. Say for example, temperature. This is a preexisting graph that I can generate in any format, including svg. I don't have to produce it using R.
>
>    When the user clicks anywhere in the map, the coordinates (longitude and latitude) have to be passed to R so that this, R, can look for the values of other variables in that location and make another graph with them.
>
>    Does anyubody know how could I accomplish this?.
>
>    Thanks in advance.
>
>
>
> Antonio Serrano
> [hidden email]
> ن
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive maps

R help mailing list-2

Thank you, Jim.

I didn't know the existence of the locator() function. But I can see now that I don't know how to read a graphic image into R to work with it.
How can I read a pre-exisiting image into R?.

Thanks again

 

 

Antonio Serrano
[hidden email]
ن

 

 

-----Original Message-----
From: Jim Lemon <[hidden email]>
To: Antonio Serrano <[hidden email]>
Cc: r-help mailing list <[hidden email]>
Sent: Sat, Apr 25, 2015 5:47 am
Subject: Re: [R] Interactive maps


Hi Antonio,
If you do create the map in R, you can use
locator().

Jim


On Sat, Apr 25, 2015 at 8:37 AM, Antonio Serrano via
R-help
<[hidden email]> wrote:
>
>  Hello, all:
>
>    I am new here,
and have a challenge to present some graphical data to the user in a convenient
way.
>
>    The challenge is to present a map to the user which is coloured
with the value of a variable. Say for example, temperature. This is a
preexisting graph that I can generate in any format, including svg. I don't have
to produce it using R.
>
>    When the user clicks anywhere in the map, the
coordinates (longitude and latitude) have to be passed to R so that this, R, can
look for the values of other variables in that location and make another graph
with them.
>
>    Does anyubody know how could I accomplish this?.
>
>  
Thanks in advance.
>
>
>
> Antonio Serrano
> [hidden email]
> ن
>
>
>
[[alternative HTML version deleted]]
>
>
______________________________________________
> [hidden email] mailing
list -- To UNSUBSCRIBE and more, see
>
https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal,
self-contained, reproducible code.



        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive maps

Michael Sumner-2
On Sun, 26 Apr 2015 at 00:56 Antonio Serrano via R-help <
[hidden email]> wrote:

>
> Thank you, Jim.
>
> I didn't know the existence of the locator() function. But I can see now
> that I don't know how to read a graphic image into R to work with it.
> How can I read a pre-exisiting image into R?.
>
> See the raster (and possibly rgdal - depending on your format/s) package
to read in images that are georeferenced. Depending on the provenance of
your files, it might be as simple as doing
library(raster)
r <- raster(filename)
plort(r)
xy <- locator(, type = "p")  ## click on the map

If the values of these are not right you'll need further digging, and
perhaps if your image is not in longitude/latitude you'll need to transform
the locator points.

Also check out ?getGraphics event in grDevices, which can be used (with
care) to build quite complex interactive applications.

Another promising option is to use a Shiny application, where each plot
gives a simple way to get click events from the user - but then you really
are building an application out in the frontier edges of R land.

Cheers, Mike.

Thanks again

>
>
>
>
>
> Antonio Serrano
> [hidden email]
> ن
>
>
>
>
>
> -----Original Message-----
> From: Jim Lemon <[hidden email]>
> To: Antonio Serrano <[hidden email]>
> Cc: r-help mailing list <[hidden email]>
> Sent: Sat, Apr 25, 2015 5:47 am
> Subject: Re: [R] Interactive maps
>
>
> Hi Antonio,
> If you do create the map in R, you can use
> locator().
>
> Jim
>
>
> On Sat, Apr 25, 2015 at 8:37 AM, Antonio Serrano via
> R-help
> <[hidden email]> wrote:
> >
> >  Hello, all:
> >
> >    I am new here,
> and have a challenge to present some graphical data to the user in a
> convenient
> way.
> >
> >    The challenge is to present a map to the user which is coloured
> with the value of a variable. Say for example, temperature. This is a
> preexisting graph that I can generate in any format, including svg. I
> don't have
> to produce it using R.
> >
> >    When the user clicks anywhere in the map, the
> coordinates (longitude and latitude) have to be passed to R so that this,
> R, can
> look for the values of other variables in that location and make another
> graph
> with them.
> >
> >    Does anyubody know how could I accomplish this?.
> >
> >
> Thanks in advance.
> >
> >
> >
> > Antonio Serrano
> > [hidden email]
> > ن
> >
> >
> >
> [[alternative HTML version deleted]]
> >
> >
> ______________________________________________
> > [hidden email] mailing
> list -- To UNSUBSCRIBE and more, see
> >
> https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal,
> self-contained, reproducible code.
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive maps

R help mailing list-2
In reply to this post by R help mailing list-2


Ok.

 
 The point now is that I have the sources (in Fortran) of the program that produces the graph with the map. And have to attach the information about the xrange and yrange to this graph in order for them to be read from R. Id est, I have to write: first longitude, first latitude, last longitude, last latitude, and also, the "figure" coordinates of the bounding box of the map in the figure.
 
 If I produce the map in eps, I can open it as a text file from the same fortran rogram, and modify the contents of the eps file in order to put the coordinates information into it.
 
 Then, once the fortran program has ended, I convert the eps to png using ImageMagic, because the EBImage library doesn't read eps, but png.
 
 In order for the png to contain the same properties as the eps, these have to be correctly defined in the eps.
 
 So, the question now is: how can I properly define properties in a eps, so that these are preserved in the convertion to png?.
 
 Perhaps this is not for this forum, but I haven't found information about it in the internet.
 
   
   
   
   
Antonio Serrano  
 [hidden email]  
    ن  
   
   
   
   
   
   
   
   
-----Original Message-----  
 From: Jim Lemon <[hidden email]>  
 To: Antonio Serrano <[hidden email]>  
 Sent: Sun, Apr 26, 2015 1:03 am  
 Subject: Re: [R] Interactive maps  
   
   
     
Hi Antonio,
If you mean the normalized figure coordinates (i.e. from 0 to 1)
then
you want something like
this:

loc_convert<-function(n=1,xrange=c(0,1),yrange=c(0,1)) {

plot_loc<-locator(n=n)
 plot_loc$x<-plot_loc$x/diff(xrange)+xrange[1]

plot_loc$y<-plot_loc$y/diff(yrange)+yrange[1]
 return(plot$loc)
}

where
xrange and yrange are the longitudes and latitudes respectively.

Jim


On
Sun, Apr 26, 2015 at 1:09 AM, Antonio Serrano <[hidden email]> wrote:
> Thank
you, Jim:
>
>    I have tried your suggestion and I get the following
error:
>
>   Error en rasterImage(image = "map.eps",  :
>    invalid color
name 'map.eps'
>
>  I have tried with three formats of the same image: svg,
gif and eps, with
> the same result.
>
> But I have found a possible better
way to accomplish this objective in the
> following thread:
>
http://r.789695.n4.nabble.com/Loading-an-image-picture-png-jpeg-to-screen-td2244923.html
>
>
In short:
>
> library(gridExtra)
> library(EBImage)
> library(RGraphics)
>
x <- readImage("http://www.google.com/logos/teachersday09.gif")
> g1 <-
ebimageGrob(x)
> dev.new(width=g1$width/72, height=g1$height/72)
>
plot.new()
> grid.draw(g1)
> c=locator(n=1, type="n")
>
> Then, when I click
on the map, I get the "figure" coordinates where I
> clicked, and still have to
translate these to longitude-latitude.
>
> And here comes another question:
How can I attach the first longitude, last
> longitude, fisrt latitude, last
latitude, to a JPEG, PNG or TIFF graphic?.
> These are the formats supported by
the EBImage package.
>
>
>
> Antonio Serrano
> [hidden email]
>
ن
>
>
> -----Original Message-----
> From: Jim Lemon
<[hidden email]>
> To: Antonio Serrano <[hidden email]>
> Sent: Sat,
Apr 25, 2015 8:36 am
> Subject: Re: [R] Interactive maps
>
> Hi Antonio,
>
Try the rasterImage function.
>
> Jim
>
>
> On Sat, Apr 25, 2015 at
> 4:19
PM, Antonio Serrano <[hidden email]> wrote:
>> Thank you, Jim.
>>
>> I
>
didn't know the existence of the locator() function. But I can see now
>> that
I
> don't know how to read a graphic image into R to work with it.
>> How can
I read
> a pre-exisiting image into R?.
>>
>> Thanks again
>>
>>
>>
Antonio Serrano
>>
> [hidden email]
>> ن
>>
>>
>> -----Original
Message-----
>> From: Jim Lemon
> <[hidden email]>
>> To: Antonio
Serrano <[hidden email]>
>> Cc: r-help
> mailing list
<[hidden email]>
>> Sent: Sat, Apr 25, 2015 5:47 am
>>
> Subject: Re:
[R] Interactive maps
>>
>> Hi Antonio,
>> If you do create the map
> in R,
you can use
>> locator().
>>
>> Jim
>>
>>
>> On Sat, Apr 25, 2015 at
8:37
> AM, Antonio Serrano via
>> R-help
>> <[hidden email]>
wrote:
>>>
>>>
> Hello, all:
>>>
>>>    I am new here,
>> and have a
challenge to present some
> graphical data to the user in a
>> convenient
>>
way.
>>>
>>>    The challenge
> is to present a map to the user which is
coloured
>> with the value of a
> variable. Say for example, temperature. This
is a
>> preexisting graph that I
> can generate in any format, including svg.
I don't
>> have
>> to produce it
> using R.
>>>
>>>    When the user clicks
anywhere in the map, the
>> coordinates
> (longitude and latitude) have to be
passed to R so that this, R,
>> can
>> look
> for the values of other
variables in that location and make another
>> graph
>>
> with
them.
>>>
>>>    Does anyubody know how could I accomplish
>
this?.
>>>
>>>
>> Thanks in advance.
>>>
>>>
>>>
>>> Antonio
Serrano
>>>
> [hidden email]
>>> ن
>>>
>>>
>>>
>> [[alternative HTML
version
> deleted]]
>>>
>>>
>>
______________________________________________
>>>
> [hidden email]
mailing
>> list -- To UNSUBSCRIBE and more, see
>>>
>>
>
https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting
>
guide
>> http://www.R-project.org/posting-guide.html
>>> and provide
commented,
> minimal,
>> self-contained, reproducible code.

   
   


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive maps

Ben Tupper-2
Hi,

You may want to redirect your question to the R-sig-Geo mailing list:

https://stat.ethz.ch/mailman/listinfo/r-sig-geo

In the meantime, you might consider writing to the 'rasterfile' format.  The 'rasterfile' format is very well documented and is to read/write from R; I suspect it would easy for you to write to this format from Fortran.  See the details here:

http://cran.r-project.org/web/packages/raster/vignettes/rasterfile.pdf

Cheers,
Ben

On Apr 27, 2015, at 11:55 AM, Antonio Serrano via R-help <[hidden email]> wrote:

>
>
> Ok.
>
>
> The point now is that I have the sources (in Fortran) of the program that produces the graph with the map. And have to attach the information about the xrange and yrange to this graph in order for them to be read from R. Id est, I have to write: first longitude, first latitude, last longitude, last latitude, and also, the "figure" coordinates of the bounding box of the map in the figure.
>
> If I produce the map in eps, I can open it as a text file from the same fortran rogram, and modify the contents of the eps file in order to put the coordinates information into it.
>
> Then, once the fortran program has ended, I convert the eps to png using ImageMagic, because the EBImage library doesn't read eps, but png.
>
> In order for the png to contain the same properties as the eps, these have to be correctly defined in the eps.
>
> So, the question now is: how can I properly define properties in a eps, so that these are preserved in the convertion to png?.
>
> Perhaps this is not for this forum, but I haven't found information about it in the internet.
>
>
>
>
>
> Antonio Serrano  
> [hidden email]  
>    ن  
>
>
>
>
>
>
>
>
> -----Original Message-----  
> From: Jim Lemon <[hidden email]>  
> To: Antonio Serrano <[hidden email]>  
> Sent: Sun, Apr 26, 2015 1:03 am  
> Subject: Re: [R] Interactive maps  
>
>
>
> Hi Antonio,
> If you mean the normalized figure coordinates (i.e. from 0 to 1)
> then
> you want something like
> this:
>
> loc_convert<-function(n=1,xrange=c(0,1),yrange=c(0,1)) {
>
> plot_loc<-locator(n=n)
> plot_loc$x<-plot_loc$x/diff(xrange)+xrange[1]
>
> plot_loc$y<-plot_loc$y/diff(yrange)+yrange[1]
> return(plot$loc)
> }
>
> where
> xrange and yrange are the longitudes and latitudes respectively.
>
> Jim
>
>
> On
> Sun, Apr 26, 2015 at 1:09 AM, Antonio Serrano <[hidden email]> wrote:
>> Thank
> you, Jim:
>>
>>   I have tried your suggestion and I get the following
> error:
>>
>>  Error en rasterImage(image = "map.eps",  :
>>   invalid color
> name 'map.eps'
>>
>> I have tried with three formats of the same image: svg,
> gif and eps, with
>> the same result.
>>
>> But I have found a possible better
> way to accomplish this objective in the
>> following thread:
>>
> http://r.789695.n4.nabble.com/Loading-an-image-picture-png-jpeg-to-screen-td2244923.html
>>
>>
> In short:
>>
>> library(gridExtra)
>> library(EBImage)
>> library(RGraphics)
>>
> x <- readImage("http://www.google.com/logos/teachersday09.gif")
>> g1 <-
> ebimageGrob(x)
>> dev.new(width=g1$width/72, height=g1$height/72)
>>
> plot.new()
>> grid.draw(g1)
>> c=locator(n=1, type="n")
>>
>> Then, when I click
> on the map, I get the "figure" coordinates where I
>> clicked, and still have to
> translate these to longitude-latitude.
>>
>> And here comes another question:
> How can I attach the first longitude, last
>> longitude, fisrt latitude, last
> latitude, to a JPEG, PNG or TIFF graphic?.
>> These are the formats supported by
> the EBImage package.
>>
>>
>>
>> Antonio Serrano
>> [hidden email]
>>
> ن
>>
>>
>> -----Original Message-----
>> From: Jim Lemon
> <[hidden email]>
>> To: Antonio Serrano <[hidden email]>
>> Sent: Sat,
> Apr 25, 2015 8:36 am
>> Subject: Re: [R] Interactive maps
>>
>> Hi Antonio,
>>
> Try the rasterImage function.
>>
>> Jim
>>
>>
>> On Sat, Apr 25, 2015 at
>> 4:19
> PM, Antonio Serrano <[hidden email]> wrote:
>>> Thank you, Jim.
>>>
>>> I
>>
> didn't know the existence of the locator() function. But I can see now
>>> that
> I
>> don't know how to read a graphic image into R to work with it.
>>> How can
> I read
>> a pre-exisiting image into R?.
>>>
>>> Thanks again
>>>
>>>
>>>
> Antonio Serrano
>>>
>> [hidden email]
>>> ن
>>>
>>>
>>> -----Original
> Message-----
>>> From: Jim Lemon
>> <[hidden email]>
>>> To: Antonio
> Serrano <[hidden email]>
>>> Cc: r-help
>> mailing list
> <[hidden email]>
>>> Sent: Sat, Apr 25, 2015 5:47 am
>>>
>> Subject: Re:
> [R] Interactive maps
>>>
>>> Hi Antonio,
>>> If you do create the map
>> in R,
> you can use
>>> locator().
>>>
>>> Jim
>>>
>>>
>>> On Sat, Apr 25, 2015 at
> 8:37
>> AM, Antonio Serrano via
>>> R-help
>>> <[hidden email]>
> wrote:
>>>>
>>>>
>> Hello, all:
>>>>
>>>>   I am new here,
>>> and have a
> challenge to present some
>> graphical data to the user in a
>>> convenient
>>>
> way.
>>>>
>>>>   The challenge
>> is to present a map to the user which is
> coloured
>>> with the value of a
>> variable. Say for example, temperature. This
> is a
>>> preexisting graph that I
>> can generate in any format, including svg.
> I don't
>>> have
>>> to produce it
>> using R.
>>>>
>>>>   When the user clicks
> anywhere in the map, the
>>> coordinates
>> (longitude and latitude) have to be
> passed to R so that this, R,
>>> can
>>> look
>> for the values of other
> variables in that location and make another
>>> graph
>>>
>> with
> them.
>>>>
>>>>   Does anyubody know how could I accomplish
>>
> this?.
>>>>
>>>>
>>> Thanks in advance.
>>>>
>>>>
>>>>
>>>> Antonio
> Serrano
>>>>
>> [hidden email]
>>>> ن
>>>>
>>>>
>>>>
>>> [[alternative HTML
> version
>> deleted]]
>>>>
>>>>
>>>
> ______________________________________________
>>>>
>> [hidden email]
> mailing
>>> list -- To UNSUBSCRIBE and more, see
>>>>
>>>
>>
> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting
>>
> guide
>>> http://www.R-project.org/posting-guide.html
>>>> and provide
> commented,
>> minimal,
>>> self-contained, reproducible code.
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Interactive maps

R help mailing list-2
Thank you, Ben. I've just subscribed to R-sig-geo as you recommend. I'll post this staff there.
 

 

Antonio Serrano
[hidden email]
ن

 

 

-----Original Message-----
From: Ben Tupper <[hidden email]>
To: Antonio Serrano <[hidden email]>
Cc: r-help <[hidden email]>
Sent: Mon, Apr 27, 2015 7:59 pm
Subject: Re: [R] Interactive maps


Hi,

You may want to redirect your question to the R-sig-Geo mailing list:


https://stat.ethz.ch/mailman/listinfo/r-sig-geo

In the meantime, you
might consider writing to the 'rasterfile' format.  The 'rasterfile' format is
very well documented and is to read/write from R; I suspect it would easy for
you to write to this format from Fortran.  See the details
here:

http://cran.r-project.org/web/packages/raster/vignettes/rasterfile.pdf

Cheers,
Ben

On
Apr 27, 2015, at 11:55 AM, Antonio Serrano via R-help <[hidden email]>
wrote:

>
>
> Ok.
>
>
> The point now is that I have the sources (in
Fortran) of the program that produces the graph with the map. And have to attach
the information about the xrange and yrange to this graph in order for them to
be read from R. Id est, I have to write: first longitude, first latitude, last
longitude, last latitude, and also, the "figure" coordinates of the bounding box
of the map in the figure.
>
> If I produce the map in eps, I can open it as a
text file from the same fortran rogram, and modify the contents of the eps file
in order to put the coordinates information into it.
>
> Then, once the
fortran program has ended, I convert the eps to png using ImageMagic, because
the EBImage library doesn't read eps, but png.
>
> In order for the png to
contain the same properties as the eps, these have to be correctly defined in
the eps.
>
> So, the question now is: how can I properly define properties in
a eps, so that these are preserved in the convertion to png?.
>
> Perhaps
this is not for this forum, but I haven't found information about it in the
internet.
>
>
>
>
>
> Antonio Serrano  
> [hidden email]  
>  
ن  

>
>
>
>
>
>
>
>
> -----Original Message-----  
> From:
Jim Lemon <[hidden email]>  
> To: Antonio Serrano <[hidden email]>  

> Sent: Sun, Apr 26, 2015 1:03 am  
> Subject: Re: [R] Interactive maps  

>
>
>
> Hi Antonio,
> If you mean the normalized figure coordinates
(i.e. from 0 to 1)
> then
> you want something like
> this:
>
>
loc_convert<-function(n=1,xrange=c(0,1),yrange=c(0,1)) {
>
>
plot_loc<-locator(n=n)
> plot_loc$x<-plot_loc$x/diff(xrange)+xrange[1]
>
>
plot_loc$y<-plot_loc$y/diff(yrange)+yrange[1]
> return(plot$loc)
> }
>
>
where
> xrange and yrange are the longitudes and latitudes respectively.
>
>
Jim
>
>
> On
> Sun, Apr 26, 2015 at 1:09 AM, Antonio Serrano
<[hidden email]> wrote:
>> Thank
> you, Jim:
>>
>>   I have tried your
suggestion and I get the following
> error:
>>
>>  Error en
rasterImage(image = "map.eps",  :
>>   invalid color
> name 'map.eps'
>>
>>
I have tried with three formats of the same image: svg,
> gif and eps, with
>>
the same result.
>>
>> But I have found a possible better
> way to
accomplish this objective in the
>> following thread:
>>
>
http://r.789695.n4.nabble.com/Loading-an-image-picture-png-jpeg-to-screen-td2244923.html
>>

>>
> In short:
>>
>> library(gridExtra)
>> library(EBImage)
>>
library(RGraphics)
>>
> x <-
readImage("http://www.google.com/logos/teachersday09.gif")
>> g1 <-
>
ebimageGrob(x)
>> dev.new(width=g1$width/72, height=g1$height/72)
>>
>
plot.new()
>> grid.draw(g1)
>> c=locator(n=1, type="n")
>>
>> Then, when I
click
> on the map, I get the "figure" coordinates where I
>> clicked, and
still have to
> translate these to longitude-latitude.
>>
>> And here comes
another question:
> How can I attach the first longitude, last
>> longitude,
fisrt latitude, last
> latitude, to a JPEG, PNG or TIFF graphic?.
>> These are
the formats supported by
> the EBImage package.
>>
>>
>>
>> Antonio
Serrano
>> [hidden email]
>>
> ن
>>
>>
>> -----Original
Message-----
>> From: Jim Lemon
> <[hidden email]>
>> To: Antonio
Serrano <[hidden email]>
>> Sent: Sat,
> Apr 25, 2015 8:36 am
>> Subject:
Re: [R] Interactive maps
>>
>> Hi Antonio,
>>
> Try the rasterImage
function.
>>
>> Jim
>>
>>
>> On Sat, Apr 25, 2015 at
>> 4:19
> PM,
Antonio Serrano <[hidden email]> wrote:
>>> Thank you, Jim.
>>>
>>> I
>>

> didn't know the existence of the locator() function. But I can see now
>>>
that
> I
>> don't know how to read a graphic image into R to work with
it.
>>> How can
> I read
>> a pre-exisiting image into R?.
>>>
>>> Thanks
again
>>>
>>>
>>>
> Antonio Serrano
>>>
>> [hidden email]
>>>
ن
>>>
>>>
>>> -----Original
> Message-----
>>> From: Jim Lemon
>>
<[hidden email]>
>>> To: Antonio
> Serrano <[hidden email]>
>>> Cc:
r-help
>> mailing list
> <[hidden email]>
>>> Sent: Sat, Apr 25, 2015
5:47 am
>>>
>> Subject: Re:
> [R] Interactive maps
>>>
>>> Hi
Antonio,
>>> If you do create the map
>> in R,
> you can use
>>>
locator().
>>>
>>> Jim
>>>
>>>
>>> On Sat, Apr 25, 2015 at
> 8:37
>>
AM, Antonio Serrano via
>>> R-help
>>> <[hidden email]>
> wrote:
>>>>

>>>>
>> Hello, all:
>>>>
>>>>   I am new here,
>>> and have a
>
challenge to present some
>> graphical data to the user in a
>>>
convenient
>>>
> way.
>>>>
>>>>   The challenge
>> is to present a map to
the user which is
> coloured
>>> with the value of a
>> variable. Say for
example, temperature. This
> is a
>>> preexisting graph that I
>> can
generate in any format, including svg.
> I don't
>>> have
>>> to produce
it
>> using R.
>>>>
>>>>   When the user clicks
> anywhere in the map,
the
>>> coordinates
>> (longitude and latitude) have to be
> passed to R so
that this, R,
>>> can
>>> look
>> for the values of other
> variables in
that location and make another
>>> graph
>>>
>> with
> them.
>>>>
>>>>  
Does anyubody know how could I accomplish
>>
> this?.
>>>>
>>>>
>>>
Thanks in advance.
>>>>
>>>>
>>>>
>>>> Antonio
> Serrano
>>>>
>>
[hidden email]
>>>> ن
>>>>
>>>>
>>>>
>>> [[alternative HTML
>
version
>> deleted]]
>>>>
>>>>
>>>
>
______________________________________________
>>>>
>>
[hidden email]
> mailing
>>> list -- To UNSUBSCRIBE and more, see
>>>>

>>>
>>
> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read
the posting
>>
> guide
>>> http://www.R-project.org/posting-guide.html
>>>>
and provide
> commented,
>> minimal,
>>> self-contained, reproducible
code.
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
______________________________________________
> [hidden email] mailing
list -- To UNSUBSCRIBE and more, see
>
https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal,
self-contained, reproducible code.

Ben Tupper
Bigelow Laboratory for Ocean
Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine
04544
http://www.bigelow.org











        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.