forked from sikli/geoserver_rest_r
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example
41 lines (35 loc) · 1.43 KB
/
example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#Specify parameters
user <- "admin" #username
password <- "geoserver" #password
geoserver.url <- "http://localhost:8080/geoserver/" #url to geoserver
workspace.name <- "myworkspace" #workspace where Tifs are going to be uploaded
img.path <- "/Users/martin/Downloads/img.tif" #tif file path
img.name <- sub(".tif", "", basename(img.path)) #tif name
style.name <- "mystyle" #Note: stlye has to be in same workspace as Tif (!!)
#-----------------------------------------UPLOAD FILES---------------------------------------------
#Load functions
source("functions.R")
#creates datastore
createDatastore(user = user,
password = password,
workspace.name = workspace.name,
img.path = img.path,
img.name = img.name,
geoserver.url = geoserver.url
)
#creates layer
createLayer(user = user,
password = password,
workspace.name = workspace.name,
img.name = img.name,
geoserver.url = geoserver.url
epsg = showEPSG(proj4string(raster(img.path)))
)
#applies style to layer
applyStyle(user = user,
password = password,
workspace.name = workspace.name,
img.name = img.name,
style.name = style.name,
geoserver.url = geoserver.url
)