Hi all,

 

I have a txt file with X,Y,Z value. I wish to create a density points Map in
R but sorry I didn't find a right code in R.

 

Part of my code is this.  I have a another  question. With many data files
to import, Is It possible don't write 10 lines like my not beautiful code? 

 

Thanks Ale

 

library(maptools)

library(rgdal)

rsaga.env(path="C:/Progra~1/saga_vc")

library(RSAGA)

library(gstat)

vegetation_2m <- read.delim("vegetation_2m.txt", sep=" ")

vegetation_3m <- read.delim("vegetation_3m.txt", sep=" ")

vegetation_4m <- read.delim("vegetation_4m.txt", sep=" ")

vegetation_5m <- read.delim("vegetation_5m.txt", sep=" ")

vegetation_6m <- read.delim("vegetation_6m.txt", sep=" ")

vegetation_7m <- read.delim("vegetation_7m.txt", sep=" ")

vegetation_8m <- read.delim("vegetation_8m.txt", sep=" ")

vegetation_9m <- read.delim("vegetation_9m.txt", sep=" ")

vegetation_10m <- read.delim("vegetation_10m.txt", sep=" ")

coordinates(vegetation_2m) =~X+Y

coordinates(vegetation_3m) =~X+Y

coordinates(vegetation_4m) =~X+Y

coordinates(vegetation_5m) =~X+Y

coordinates(vegetation_6m) =~X+Y

coordinates(vegetation_7m) =~X+Y

coordinates(vegetation_8m) =~X+Y

coordinates(vegetation_9m) =~X+Y

proj4string(vegetation_2m) <- CRS("+init=epsg:26911")

proj4string(vegetation_3m) <- CRS("+init=epsg:26911")

proj4string(vegetation_4m) <- CRS("+init=epsg:26911")

proj4string(vegetation_5m) <- CRS("+init=epsg:26911")

proj4string(vegetation_6m) <- CRS("+init=epsg:26911")

proj4string(vegetation_7m) <- CRS("+init=epsg:26911")

proj4string(vegetation_8m) <- CRS("+init=epsg:26911")

proj4string(vegetation_9m) <- CRS("+init=epsg:26911")

#convert in .shp to use RSAGA

writeOGR(vegetation_2m["Z"], "vegetation_2m.shp", "vegetation_2m",
driver="ESRI Shapefile")

writeOGR(vegetation_3m["Z"], "vegetation_3m.shp", "vegetation_3m",
driver="ESRI Shapefile")

writeOGR(vegetation_4m["Z"], "vegetation_4m.shp", "vegetation_4m",
driver="ESRI Shapefile")

writeOGR(vegetation_5m["Z"], "vegetation_5m.shp", "vegetation_5m",
driver="ESRI Shapefile")

writeOGR(vegetation_6m["Z"], "vegetation_6m.shp", "vegetation_6m",
driver="ESRI Shapefile")

writeOGR(vegetation_7m["Z"], "vegetation_7m.shp", "vegetation_7m",
driver="ESRI Shapefile")

writeOGR(vegetation_8m["Z"], "vegetation_8m.shp", "vegetation_8m",
driver="ESRI Shapefile")

writeOGR(vegetation_9m["Z"], "vegetation_9m.shp", "vegetation_9m",
driver="ESRI Shapefile")

 


	[[alternative HTML version deleted]]


