<HTML XMLNS:U1 xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<HEAD><!-- Template generated by Exclaimer Mail Disclaimers on 04:48:20 Tuesday, 20 October 2015 -->
<STYLE type=text/css>P.c46b1bd4-f878-4754-9cb5-17668485ab19 {
        MARGIN: 0cm 0cm 0pt
}
LI.c46b1bd4-f878-4754-9cb5-17668485ab19 {
        MARGIN: 0cm 0cm 0pt
}
DIV.c46b1bd4-f878-4754-9cb5-17668485ab19 {
        MARGIN: 0cm 0cm 0pt
}
TABLE.c46b1bd4-f878-4754-9cb5-17668485ab19Table {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
</STYLE>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Generator" content="Microsoft Word 14 (filtered medium)" />
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"\@SimSun-ExtB";
        panose-1:2 1 6 9 6 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Texto sin formato Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texto de globo Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-US;}
span.EstiloCorreo17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.TextosinformatoCar
        {mso-style-name:"Texto sin formato Car";
        mso-style-priority:99;
        mso-style-link:"Texto sin formato";
        font-family:"Calibri","sans-serif";}
span.TextodegloboCar
        {mso-style-name:"Texto de globo Car";
        mso-style-priority:99;
        mso-style-link:"Texto de globo";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</HEAD>

<BODY lang="ES" link="blue" vlink="purple">
<P class=c46b1bd4-f878-4754-9cb5-17668485ab19>
<div class="WordSection1">
<p class="MsoPlainText">Hola:<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Estoy intentando generar un mapa de calor que muestre, dadas unas coordenadas geográficas determinadas, el “calor” (cuanto mas alto el valor de esta variable mas rojo y cuanto mas bajo mas azul) de una determinada variable.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Es decir con unos datos como estos:<o:p></o:p></p>
<p class="MsoPlainText">x                             y                             z<o:p></o:p></p>
<p class="MsoPlainText">-3,716575            40,41743              3.169<o:p></o:p></p>
<p class="MsoPlainText">-3,710735            40,42179              4.134<o:p></o:p></p>
<p class="MsoPlainText">-3,704625            40,40333              2.606<o:p></o:p></p>
<p class="MsoPlainText">-3,703929            40,40363              2.563<o:p></o:p></p>
<p class="MsoPlainText">-3,686431            40,36133              1.452<o:p></o:p></p>
<p class="MsoPlainText">-3,682371            40,35542              1.523<o:p></o:p></p>
<p class="MsoPlainText">-3,675325            40,41986              4.122<o:p></o:p></p>
<p class="MsoPlainText">-3,673758            40,41978              4.098<o:p></o:p></p>
<p class="MsoPlainText">-3,645127            40,42780              2.306<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Donde el data frame datos contiene:<o:p></o:p></p>
<p class="MsoPlainText">x: Longitud<o:p></o:p></p>
<p class="MsoPlainText">y: Latitud<o:p></o:p></p>
<p class="MsoPlainText">z:  Variable a estudiar<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">lo que quiero es mostrar sobre un fondo de GoogleMaps, otra capa(semitransparente)  con el  Calor de la variable.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Para ello primero calculo una aproximación de superficies de mis puntos usando MBA<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">##Cargamos paquetes<o:p></o:p></p>
<p class="MsoPlainText">library(MBA)<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">##Calculamos aproximacion de superficies segun coordenadas y valores<o:p></o:p></p>
<p class="MsoPlainText">superf <- mba.surf(datos, 2000, 2000,extend=FALSE)$xyz.est<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">##Obtenemos la capa con los colores a partir de la aproximación de superficies<o:p></o:p></p>
<p class="MsoPlainText"><span lang="EN-US">image.plot(superf,  bg= NULL, nlevel = param$NIVELES)<o:p></o:p></span></p>
<p class="MsoPlainText"><span style=mso-fareast-language:ES><img width="548" height="374" id="Imagen_x0020_2" src='cid:image001.png@01D10B5D.6039CD80' /></span><o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Por otro lado obtengo el mapa de google maps sobre el cual deberia ir esto asi:<o:p></o:p></p>
<p class="MsoPlainText">#Cargamos paquete<o:p></o:p></p>
<p class="MsoPlainText">library(ggmap)<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">##Centro del mapa<o:p></o:p></p>
<p class="MsoPlainText">center <- c(mean(datos$x), mean(datos$y))<o:p></o:p></p>
<p class="MsoPlainText"><span lang="EN-US">##Zoom<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US">zoom <- min(MaxZoom(range(datos$x), range(datos$x)))<o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText">##Obtenenmos mapa base<o:p></o:p></p>
<p class="MsoPlainText"><span lang="EN-US">mapa <- get_map(center, zoom = 12)<o:p></o:p></span></p>
<p class="MsoPlainText"><span style=mso-fareast-language:ES><img width="548" height="374" id="Imagen_x0020_1" src='cid:image002.png@01D10B5D.6039CD80' /></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoPlainText"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoPlainText">Lo que ya no consigo hacer es poner la imagen con los colores sobre el mapa de forma que este correctamente calibrada.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Seguro que todo esto se pude hacer de un tiron con ggmap y/o RgoogleMaps pero por mas que miro no veo la manera de meter el objeto superf “dentro” de un mapa.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Muchas Gracias<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
</div>
</P>
<P><FONT face=Arial><FONT color=#a5a5a5 size=1>TASACIONES HIPOTECARIAS 
S.A.<BR />Registration number: A-28/806222.<BR />Registered Office: Pº de la 
Castellana, 79 - 1ª ; 28046 Madrid</FONT></FONT></P>
<P><FONT color=#a5a5a5 size=1 face=Arial>This e-mail is for the use of the 
intended recipient(s) only. If you have received this e-mail in error, please 
notify the sender immediately and then delete it. If you are not the intended 
recipient, you must not use, disclose or distribute this e-mail without the 
author's prior permission. We have taken precautions to minimise the risk of 
transmitting software viruses, but we advise you to carry out your own virus 
checks on any attachment to this message. We cannot accept liability for any 
loss or damage caused by software viruses. If you are the intended recipient and 
you do not wish to receive similar electronic messages from us in future then 
please respond to the sender to this effect</FONT></P></BODY>
</HTML>