______________________________________
José Manuel Prieto
https://jmprietob.shinyapps.io/eltiempo/
es.linkedin.com/in/josemanuelprietoblazquez/
El 20 de octubre de 2015, 22:35, Carlos J. Gil Bellosta < cgb en datanalytics.com>
escribió:
Hola, ¿qué tal?
Tienes que hacer algo asà como
ggmap(mapa) + stat_density2d([...])
Tienes ejemplos completos en el artÃculo de Wickham
https://journal.r-project.org/archive/2013-1/kahle-wickham.pdf
Un saludo,
Carlos J. Gil Bellosta
http://www.datanalytics.com
El 20 de octubre de 2015, 17:39, Gilsanz, Jose Luis <
jluis.gilsanz en eu.jll.com> escribió:
Hola:
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.
Es decir con unos datos como estos:
x y z
-3,716575 40,41743 3.169
-3,710735 40,42179 4.134
-3,704625 40,40333 2.606
-3,703929 40,40363 2.563
-3,686431 40,36133 1.452
-3,682371 40,35542 1.523
-3,675325 40,41986 4.122
-3,673758 40,41978 4.098
-3,645127 40,42780 2.306
Donde el data frame datos contiene:
x: Longitud
y: Latitud
z: Variable a estudiar
lo que quiero es mostrar sobre un fondo de GoogleMaps, otra
capa(semitransparente) con el Calor de la variable.
Para ello primero calculo una aproximación de superficies de mis
puntos usando MBA
##Cargamos paquetes
library(MBA)
##Calculamos aproximacion de superficies segun coordenadas y valores
superf <- mba.surf(datos, 2000, 2000,extend=FALSE)$xyz.est
##Obtenemos la capa con los colores a partir de la aproximación de
superficies
image.plot(superf, bg= NULL, nlevel = param$NIVELES)
Por otro lado obtengo el mapa de google maps sobre el cual deberia ir
esto asi:
#Cargamos paquete
library(ggmap)
##Centro del mapa
center <- c(mean(datos$x), mean(datos$y))
##Zoom
zoom <- min(MaxZoom(range(datos$x), range(datos$x)))
##Obtenenmos mapa base
mapa <- get_map(center, zoom = 12)
Lo que ya no consigo hacer es poner la imagen con los colores sobre
el mapa de forma que este correctamente calibrada.
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.
Muchas Gracias
TASACIONES HIPOTECARIAS S.A.
Registration number: A-28/806222.
Registered Office: Pº de la Castellana, 79 - 1ª ; 28046 Madrid
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
_______________________________________________
R-help-es mailing list
R-help-es en r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es
_______________________________________________
R-help-es mailing list
R-help-es en r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <https://stat.ethz.ch/pipermail/r-help-
es/attachments/20151021/14626e2b/attachment.html>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 13312 bytes
Desc: no disponible
URL: <https://stat.ethz.ch/pipermail/r-help-
es/attachments/20151021/14626e2b/attachment.png>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 265395 bytes
Desc: no disponible
URL: <https://stat.ethz.ch/pipermail/r-help-
es/attachments/20151021/14626e2b/attachment-0001.png>
------------------------------
Subject: Pié de página del digest
_______________________________________________
R-help-es mailing list
R-help-es en r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es
------------------------------
Fin de Resumen de R-help-es, Vol 80, EnvÃo 28
*********************************************