11 AĞUSTOS 2009, Salı
R ile gelişmekte olan Coğrafi Tematik Haritalar
Açıkça mekansal analiz her türlü Ar paketleri vardır. O CRAN Task View: Analysis of Spatial Data görülür. Bu paketler, çok sayıda ve çeşitlidir, ama tek istediğim 7 ** bazı basit. İl ve FIPS devlet kodları ile veri var ve bu veri ile katılmayı sağlayan il ve devlet sınırları ve beraberindeki FIPS kodları ESRI şekil dosyaları var. Şekil dosyaları kolayca gerekirse diğer formatları için dönüştürülmüş olabilir.
En yalındır şekilde R ile tematik haritalar oluşturmak için ne kadar?
Bu harita da gösteriyor ki Çin Arc ürünü ile oluşmuş gibi görünüyor, ama bu R ile yapmak istediğim birşey
copied from here Göster.
CEVAP
11 AĞUSTOS 2009, Salı
Aşağıdaki kodu çok işime yarıyor. Biraz özelleştirmek ve bitirdiniz.
library(maptools)
substitute your shapefiles here
state.map <- readShapeSpatial("BRASIL.shp")
counties.map <- readShapeSpatial("55mu2500gsd.shp")
## this is the variable we will be plotting
counties.map@data$noise <- rnorm(nrow(counties.map@data))
ilgi haritası işlevi
plot.heat <- function(counties.map,state.map,z,title=NULL,breaks=NULL,reverse=FALSE,cex.legend=1,bw=.2,col.vec=NULL,plot.legend=TRUE) {
##Break down the value variable
if (is.null(breaks)) {
breaks=
seq(
floor(min(counties.map@data[,z],na.rm=TRUE)*10)/10
,
ceiling(max(counties.map@data[,z],na.rm=TRUE)*10)/10
,.1)
}
counties.map@data$zCat <- cut(counties.map@data[,z],breaks,include.lowest=TRUE)
cutpoints <- levels(counties.map@data$zCat)
if (is.null(col.vec)) col.vec <- heat.colors(length(levels(counties.map@data$zCat)))
if (reverse) {
cutpointsColors <- rev(col.vec)
} else {
cutpointsColors <- col.vec
}
levels(counties.map@data$zCat) <- cutpointsColors
plot(counties.map,border=gray(.8), lwd=bw,axes = FALSE, las = 1,col=as.character(counties.map@data$zCat))
if (!is.null(state.map)) {
plot(state.map,add=TRUE,lwd=1)
}
##with(counties.map.c,text(x,y,name,cex=0.75))
if (plot.legend) legend("bottomleft", cutpoints, fill = cutpointsColors,bty="n",title=title,cex=cex.legend)
##title("Cartogram")
}
bu arsa
plot.heat(counties.map,state.map,z="noise",breaks=c(-Inf,-2,-1,0,1,2,Inf))
Bunu Paylaş:
Gelişmekte olan ve Facebook uygulaması...
Nasıl Haritalar coğrafi uri Niyet tara...
Deneyimlerinizi Scala/Lift gelişmekte ...
C gelişmekte olan# Linux...
En iyi yol google Haritalar ESRI şekil...