Skip to content

Commit f3450fd

Browse files
committed
use a layout from GADM
1 parent f2366e9 commit f3450fd

5 files changed

+53
-0
lines changed

antaresVizLayout.Rmd

+53
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,56 @@ plotMap(x = refData,
266266
267267
```
268268

269+
## Get a layout from another source
270+
271+
A user can choose to import a different layout from the default one.
272+
The default one is obtained from `spMaps::getSpMaps()`. Anyone can download some `SpatialPolygonsDataFrame`, for example, from [here](https://gadm.org/download_country_v3.html).
273+
274+
Here, we have choose :
275+
- Spain, Level 1 ;
276+
- Belgium, Level 1 ;
277+
- France, Level 2.
278+
279+
```{r rbindSP, echo = TRUE, eval = TRUE}
280+
281+
#before using it in mapLayout, we must read all the files
282+
283+
sp1 <- readRDS(file = "inst/sp/gadm36_ESP_1_sp.rds")
284+
be1 <- readRDS(file = "inst/sp/gadm36_BEL_1_sp.rds")
285+
fr2 <- readRDS(file = "inst/sp/gadm36_FRA_2_sp.rds")
286+
287+
#same level use rbind
288+
spBe <- rbind(sp1, be1)
289+
#different level use union
290+
spBeFr <- union(spBe, fr2)
291+
mlNewMap <- mapLayout(layout = posLayout, map = spBeFr)
292+
saveRDS(object = mlNewMap,
293+
file = "inst/mlNewMap.RDS")
294+
295+
```
296+
297+
.......
298+
299+
```{r plotMapLayoutCT, echo = TRUE, eval = TRUE}
300+
301+
mlNewMap <- readRDS(file = "inst/mlNewMap.RDS")
302+
plotMapLayout(mlNewMap)
303+
304+
```
305+
306+
.......
307+
308+
```{r plotMapCT, echo = TRUE, eval = TRUE}
309+
310+
plotMap(x = refData,
311+
mapLayout = mlNewMap,
312+
interactive = FALSE,
313+
colAreaVar = "LOAD",
314+
colLinkVar = "FLOW LIN.",
315+
type = "avg",
316+
typeSizeAreaVars = TRUE,
317+
aliasSizeAreaVars = c("generation", "renewable"),
318+
sizeMiniPlot = TRUE,
319+
areaChartType = "pie")
320+
321+
```

inst/mlNewMap.RDS

208 KB
Binary file not shown.

inst/sp/gadm36_BEL_1_sp.rds

65.1 KB
Binary file not shown.

inst/sp/gadm36_ESP_1_sp.rds

1.17 MB
Binary file not shown.

inst/sp/gadm36_FRA_2_sp.rds

1.16 MB
Binary file not shown.

0 commit comments

Comments
 (0)