-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
143 changed files
with
185 additions
and
195 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
collections/qgis-rscripts3/rscripts/Minimum_convex_polygon.rsx
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
collections/qgis-rscripts3/rscripts/Random_sampling_grid.rsx
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
collections/qgis-rscripts3/rscripts/Regular_sampling_grid.rsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
##Basic statistics=group | ||
##Layer1=vector | ||
##Layer2=vector | ||
##Field=Field Layer1 | ||
##output= output vector | ||
library(geosphere) | ||
library(rgeos) | ||
line<-gLineMerge(Layer2, byid=FALSE, id = NULL) | ||
x<-coordinates(Layer1) | ||
X<-dist2Line(x, line, distfun=distHaversine) | ||
matrix<-as.matrix(X[,2:3]) | ||
X<-cbind(X, as.data.frame(Layer1[[Field]])) | ||
result<-SpatialPointsDataFrame(matrix, as.data.frame(X, row.names=NULL)) | ||
proj4string(Layer1)->crs | ||
proj4string(result)<-crs | ||
output<-result | ||
##Input_Point_Layer=vector | ||
##Line_Layer=vector | ||
##ID_Field=Field Input_Point_Layer | ||
##Nearest=output vector | ||
library(geosphere) | ||
library(rgeos) | ||
|
||
# Remove the z and m dimensions | ||
PointsXY=st_zm(Input_Point_Layer) | ||
LinesXY=st_zm(Line_Layer) | ||
# Change format | ||
SpatPointsXY=as(PointsXY, "Spatial") | ||
SpatLinesXY=as(LinesXY, "Spatial") | ||
|
||
line=gLineMerge(SpatLinesXY, byid=FALSE, id = NULL) | ||
x=coordinates(SpatPointsXY) | ||
X=dist2Line(x, line, distfun=distHaversine) | ||
matrix=as.matrix(X[,2:3]) | ||
X=cbind(X, as.data.frame(SpatPointsXY[[ID_Field]])) | ||
result=SpatialPointsDataFrame(matrix, as.data.frame(X, row.names=NULL)) | ||
Nearest=st_set_crs(st_as_sf(result),st_crs(Input_Point_Layer)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"Layer2": "a line", "ALG_DESC": "This script calculates the distance between two geometries: a line and points.", "ALG_CREATOR": "JEANDENANS L.", "Layer1": "a set of data (points)", "Field": "identification of points", "ALG_HELP_CREATOR": "JEANDENANS L.", "output": "a shapfile with points and the distance."} | ||
{"Line_Layer": "A line layer", "ALG_DESC": "This script calculates the distance from points in a point layer to the nearest line in a line layer. Coordinates have to be in the latitude / longitude ranges.", "ALG_CREATOR": "QGIS community", "Input_Point_Layer": "a set of points (lat/lon)", "Field": "ID field for the points", "ALG_HELP_CREATOR": "QGIS community", "Nearest": "A point layer (the nearest point on the line for each input point) with the distance."} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
collections/qgis_rscripts/rscripts/Minimum_convex_polygon.rsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
##Home Range Analysis=group | ||
##Layer=vector | ||
##Percentage=number 10 | ||
##Percentage=number 90 | ||
##Field=Field Layer | ||
##Home_ranges=Output vector | ||
library(adehabitatHR) | ||
Home_ranges<-mcp(Layer[,Field],percent=Percentage) | ||
|
||
SpatialLayer = as(Layer, "Spatial") | ||
HR<-mcp(SpatialLayer[,Field],percent=Percentage) | ||
Home_ranges<-st_as_sf(HR) | ||
|
||
|
10 changes: 6 additions & 4 deletions
10
collections/qgis_rscripts/rscripts/Monte-Carlo_spatial_randomness.rsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
##Point pattern analysis=group | ||
##Layer=vector point | ||
##Simulations=number 100 | ||
##Optional_plot_name=string | ||
##Plot_name=string 'K function' | ||
##showplots | ||
library(spatstat) | ||
library(maptools) | ||
sp <- as(Layer, "SpatialPoints") | ||
|
||
sp <- as(Layer, "Spatial") | ||
sp <- as(sp, "ppp") | ||
|
||
e <- envelope(sp, Kest, nsim = Simulations) | ||
>e | ||
plot(e, main = Optional_plot_name) | ||
plot(e, main = Plot_name) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
collections/qgis_rscripts/rscripts/Random_sampling_grid.rsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
##Point pattern analysis=group | ||
##Layer=vector | ||
##Layer=vector polygon | ||
##Size=number 10 | ||
##Output= output vector | ||
pts=spsample(Layer,Size,type="random") | ||
Output=SpatialPointsDataFrame(pts, as.data.frame(pts)) | ||
spatpoly = as(Layer, "Spatial") | ||
|
||
pts=spsample(spatpoly,Size,type="random") | ||
spdf=SpatialPointsDataFrame(pts, as.data.frame(pts)) | ||
|
||
Output=st_as_sf(spdf) |
10 changes: 7 additions & 3 deletions
10
collections/qgis_rscripts/rscripts/Regular_sampling_grid.rsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
##Point pattern analysis=group | ||
##Layer=vector | ||
##Layer=vector polygon | ||
##Size=number 10 | ||
##Output= output vector | ||
pts=spsample(Layer,Size,type="regular") | ||
Output=SpatialPointsDataFrame(pts, as.data.frame(pts)) | ||
spatpoly = as(Layer, "Spatial") | ||
|
||
pts=spsample(spatpoly,Size,type="regular") | ||
spdf=SpatialPointsDataFrame(pts, as.data.frame(pts)) | ||
|
||
Output=st_as_sf(spdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,43 @@ | ||
##Basic statistics=group | ||
##Layer=raster | ||
##x_depart= number 0.1 | ||
##y_depart= number 0.1 | ||
##x_arrivee= number 0.1 | ||
##y_arrivee= number 1 | ||
##DEM_Layer=raster | ||
# ##Start=point | ||
##x_start=number 10.0 | ||
##y_start=number 60.0 | ||
# ##Destination=point | ||
##x_destination=number 11.0 | ||
##y_destination=number 59.0 | ||
##Output= output vector | ||
library(gdistance) | ||
library(rgdal) | ||
datas<-raster(Layer) | ||
|
||
dem=raster(DEM_Layer) | ||
|
||
heightDiff <-function(x)(x[2] - x[1]) | ||
hd <- transition(datas,heightDiff,8)#packages gdistance | ||
hd <- transition(dem,heightDiff,8)#packages gdistance | ||
slope <- geoCorrection(hd, scl=FALSE)#packages gdistance | ||
adj <- adjacent(x = datas, cells = 1:ncell(datas),pairs=TRUE ,directions=8) #packages raster | ||
adj <- adjacent(x=dem, cells=1:ncell(dem), pairs=TRUE, directions=8) #packages raster | ||
speed <- slope | ||
speed[adj] <- exp(-3.5 * abs(slope[adj])+0.05) | ||
speed<-geoCorrection(speed) #packages gdistance | ||
>print("--speed------------------------------------------------------") | ||
>str(speed) | ||
|
||
Ax=x_depart | ||
Ay=y_depart | ||
Bx=x_arrivee | ||
By=y_arrivee | ||
Ax=x_start | ||
Ay=y_start | ||
Bx=x_destination | ||
By=y_destination | ||
|
||
c1<-c(Ax, Ay) | ||
#c1=Start | ||
>print("--c1------------------------------------------------------") | ||
>str(c1) | ||
|
||
c2<-c(Bx, By) | ||
#c2 = Destination | ||
>print("---c2-----------------------------------------------") | ||
>str(c2) | ||
|
||
sPath1 <-shortestPath(speed, c1, c2,output="SpatialLines") | ||
Output=SpatialLinesDataFrame(sPath1, data=as.data.frame(c(1:length(sPath1))), match.ID = F) | ||
sldf=SpatialLinesDataFrame(sPath1, data=as.data.frame(c(1:length(sPath1))), match.ID = F) | ||
Output=st_as_sf(sldf) | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
##Basic statistics=group | ||
##Layer1=vector | ||
##Layer2=vector | ||
##Field=Field Layer1 | ||
##output= output vector | ||
library(geosphere) | ||
library(rgeos) | ||
line<-gLineMerge(Layer2, byid=FALSE, id = NULL) | ||
x<-coordinates(Layer1) | ||
X<-dist2Line(x, line, distfun=distHaversine) | ||
matrix<-as.matrix(X[,2:3]) | ||
X<-cbind(X, as.data.frame(Layer1[[Field]])) | ||
result<-SpatialPointsDataFrame(matrix, as.data.frame(X, row.names=NULL)) | ||
proj4string(Layer1)->crs | ||
proj4string(result)<-crs | ||
output<-result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Layer2": "a line", "ALG_DESC": "This script calculates the distance between two geometries: a line and points.", "ALG_CREATOR": "JEANDENANS L.", "Layer1": "a set of data (points)", "Field": "identification of points", "ALG_HELP_CREATOR": "JEANDENANS L.", "output": "a shapfile with points and the distance."} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.