Skip to content

Commit

Permalink
Create distribution for MTN grids #61
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Nov 29, 2021
1 parent 7a6e88a commit 5e53d64
Show file tree
Hide file tree
Showing 61 changed files with 498 additions and 73 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ doc
Meta
CRAN-RELEASE
cran-comments.md
vignettes/
dev/
Binary file added MTN/MTN/img/grid-preview-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/MTN/img/grid-preview-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/MTN/img/grid-preview-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/MTN/img/grid-preview-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/MTN/img/grid-preview-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/MTN/img/grid-preview-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/MTN/img/grid-preview-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 161 additions & 0 deletions MTN/README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
title: "MTN Grids"
output:
github_document:
html_preview: false
toc: true
toc_depth: 3
---

```{r config, message=FALSE, warning=FALSE, include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
tidy = "styler",
comment = "#>",
fig.path = "MTN/img/grid-"
)
library(sf)
library(dplyr)
```

**Updated: `r Sys.Date()`**

## DESCRIPCIÓN DE LOS DISTINTOS JUEGOS DE CUADRÍCULAS CARTOGRÁFICAS (ES)

- **MTN25_ED50_Peninsula_Baleares.shp**

Cuadrícula del MTN25 correspondiente a la Península e Islas Baleares, en
ED50 y coordenadas geográficas (longitud, latitud) Se trata de la cuadrícula
real del MTN25, es decir, aquella que divide a la serie impresa actual del
mapa, teniendo en cuenta hojas especiales e irregularidades.

- **MTN50_ED50_Peninsula_Baleares.shp**

Cuadrícula del MTN50 correspondiente a la Península e Islas Baleares, en
ED50 y coordenadas geográficas (longitud, latitud) Se trata de la cuadrícula
real del MTN50, es decir, aquella que divide a la serie impresa actual del
mapa, teniendo en cuenta hojas especiales e irregularidades.

- **MTN25_ETRS89_ceuta_melilla_alboran.shp**

Cuadrícula del MTN25 correspondiente a Ceuta, Melilla, Alborán y posesiones
españolas en el Norte de África, ajustada al nuevo sistema geodésico de
referencia oficial ETRS89, en coordenadas geográficas (longitud, latitud).

- **MTN25_ETRS89_Peninsula_Baleares_Canarias.shp**

Cuadrícula real del MTN25 correspondiente a la Península, Baleares y
Canarias, ajustada al nuevo sistema geodésico de referencia oficial ETRS89,
en coordenadas geográficas (longitud, latitud).

- **MTN50_ETRS89_Peninsula_Baleares_Canarias.shp**

Cuadrícula real del MTN50 correspondiente a la Península, Baleares y
Canarias, ajustada al nuevo sistema geodésico de referencia oficial ETRS89,
en coordenadas geográficas (longitud, latitud).

- **MTN25_RegCan95_Canarias.shp**

Cuadrícula del MTN25 correspondiente a Canarias, en REGCAN95 (compatible
WGS84) y coordenadas geográficas (longitud, latitud). Se trata de la
cuadrícula real del MTN25, es decir, aquella que divide a la serie impresa
actual del mapa, teniendo en cuenta la distribución especial de las hojas de
Canarias.

- **MTN50_RegCan95_Canarias.shp**

Cuadrícula del MTN50 correspondiente a Canarias, en REGCAN95 (compatible
WGS84) y coordenadas geográficas (longitud, latitud). Se trata de la
cuadrícula real del MTN50, es decir, aquella que divide a la serie impresa
actual del mapa, teniendo en cuenta la distribución especial de las hojas de
Canarias.

## DESCRIPTION OF THE DIFFERENT CARTOGRAPHIC GRID ITEMS (EN)

- **MTN25_ED50_Peninsula_Baleares.shp**

MTN25 grid corresponding to the Peninsula and Balearic Islands, in ED50 and
geographical coordinates (longitude, latitude) This is the real MTN25 grid,
that is, the one that divides the current printed series of the map, taking
into account special sheets and irregularities.

- **MTN50_ED50_Peninsula_Baleares.shp**

MTN50 grid corresponding to the Peninsula and Balearic Islands, in ED50 and
geographical coordinates (longitude, latitude) This is the real MTN50 grid,
that is, the one that divides the current printed series of the map, taking
into account special sheets and irregularities.

- **MTN25_ETRS89_ceuta_melilla_alboran.shp**

MTN25 grid corresponding to Ceuta, Melilla, Alboran and Spanish territories
in North Africa, adjusted to the new official geodetic reference system
ETRS89, in geographical coordinates (longitude, latitude).

- **MTN25_ETRS89_Peninsula_Baleares_Canarias.shp**

MTN25 real grid corresponding to the Peninsula, the Balearic Islands and the
Canary Islands, adjusted to the new ETRS89 official reference geodetic
system, in geographical coordinates (longitude, latitude).

- **MTN50_ETRS89_Peninsula_Baleares_Canarias.shp**

MTN50 real grid corresponding to the Peninsula, the Balearic Islands and the
Canary Islands, adjusted to the new ETRS89 official reference geodetic
system, in geographical coordinates (longitude, latitude).

- **MTN25_RegCan95_Canarias.shp**

MTN25 grid corresponding to the Canary Islands, in REGCAN95 (WGS84
compatible) and geographic coordinates (longitude, latitude). It is the real
MTN25 grid, that is, the one that divides the current printed series of the
map, taking into account the special distribution of the Canary Islands
sheets.

- **MTN50_RegCan95_Canarias.shp**

MTN50 grid corresponding to the Canary Islands, in REGCAN95 (WGS84
compatible) and geographic coordinates (longitude, latitude). This is the
real grid of the MTN50, that is, the one that divides the current printed
series of the map, taking into account the special distribution of the
Canary Islands sheets.

## Table of files

Full reference of each dataset in the [source](./MTN/source) folder.

There are `r length(list.files("dist/", ".gpkg"))` files available:

```{r echo=FALSE, message=FALSE}
library(dplyr)
files <-
list.files("dist/", ".gpkg")
df <- data.frame(
file = files,
stringsAsFactors = FALSE
)
knitr::kable(df)
```


## Preview

```{r preview, echo=FALSE, fig.keep="all", message=FALSE, warning=FALSE, out.width="33%"}
par(mar = c(2, 2, 2, 2))
for (i in seq_len(nrow(df))) {
path <- file.path("dist", df[i, "file"])
input <- st_read(path, stringsAsFactors = FALSE, quiet = TRUE)
plot(st_geometry(input), axes = TRUE, main = df[i, "file"])
}
```
139 changes: 139 additions & 0 deletions MTN/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
MTN Grids
================

- [DESCRIPCIÓN DE LOS DISTINTOS JUEGOS DE CUADRÍCULAS CARTOGRÁFICAS
(ES)](#descripción-de-los-distintos-juegos-de-cuadrículas-cartográficas-es)
- [DESCRIPTION OF THE DIFFERENT CARTOGRAPHIC GRID ITEMS
(EN)](#description-of-the-different-cartographic-grid-items-en)
- [Table of files](#table-of-files)
- [Preview](#preview)

**Updated: 2021-11-30**

## DESCRIPCIÓN DE LOS DISTINTOS JUEGOS DE CUADRÍCULAS CARTOGRÁFICAS (ES)

- **MTN25_ED50_Peninsula_Baleares.shp**

Cuadrícula del MTN25 correspondiente a la Península e Islas
Baleares, en ED50 y coordenadas geográficas (longitud, latitud) Se
trata de la cuadrícula real del MTN25, es decir, aquella que divide
a la serie impresa actual del mapa, teniendo en cuenta hojas
especiales e irregularidades.

- **MTN50_ED50_Peninsula_Baleares.shp**

Cuadrícula del MTN50 correspondiente a la Península e Islas
Baleares, en ED50 y coordenadas geográficas (longitud, latitud) Se
trata de la cuadrícula real del MTN50, es decir, aquella que divide
a la serie impresa actual del mapa, teniendo en cuenta hojas
especiales e irregularidades.

- **MTN25_ETRS89_ceuta_melilla_alboran.shp**

Cuadrícula del MTN25 correspondiente a Ceuta, Melilla, Alborán y
posesiones españolas en el Norte de África, ajustada al nuevo
sistema geodésico de referencia oficial ETRS89, en coordenadas
geográficas (longitud, latitud).

- **MTN25_ETRS89_Peninsula_Baleares_Canarias.shp**

Cuadrícula real del MTN25 correspondiente a la Península, Baleares y
Canarias, ajustada al nuevo sistema geodésico de referencia oficial
ETRS89, en coordenadas geográficas (longitud, latitud).

- **MTN50_ETRS89_Peninsula_Baleares_Canarias.shp**

Cuadrícula real del MTN50 correspondiente a la Península, Baleares y
Canarias, ajustada al nuevo sistema geodésico de referencia oficial
ETRS89, en coordenadas geográficas (longitud, latitud).

- **MTN25_RegCan95_Canarias.shp**

Cuadrícula del MTN25 correspondiente a Canarias, en REGCAN95
(compatible WGS84) y coordenadas geográficas (longitud, latitud). Se
trata de la cuadrícula real del MTN25, es decir, aquella que divide
a la serie impresa actual del mapa, teniendo en cuenta la
distribución especial de las hojas de Canarias.

- **MTN50_RegCan95_Canarias.shp**

Cuadrícula del MTN50 correspondiente a Canarias, en REGCAN95
(compatible WGS84) y coordenadas geográficas (longitud, latitud). Se
trata de la cuadrícula real del MTN50, es decir, aquella que divide
a la serie impresa actual del mapa, teniendo en cuenta la
distribución especial de las hojas de Canarias.

## DESCRIPTION OF THE DIFFERENT CARTOGRAPHIC GRID ITEMS (EN)

- **MTN25_ED50_Peninsula_Baleares.shp**

MTN25 grid corresponding to the Peninsula and Balearic Islands, in
ED50 and geographical coordinates (longitude, latitude) This is the
real MTN25 grid, that is, the one that divides the current printed
series of the map, taking into account special sheets and
irregularities.

- **MTN50_ED50_Peninsula_Baleares.shp**

MTN50 grid corresponding to the Peninsula and Balearic Islands, in
ED50 and geographical coordinates (longitude, latitude) This is the
real MTN50 grid, that is, the one that divides the current printed
series of the map, taking into account special sheets and
irregularities.

- **MTN25_ETRS89_ceuta_melilla_alboran.shp**

MTN25 grid corresponding to Ceuta, Melilla, Alboran and Spanish
territories in North Africa, adjusted to the new official geodetic
reference system ETRS89, in geographical coordinates (longitude,
latitude).

- **MTN25_ETRS89_Peninsula_Baleares_Canarias.shp**

MTN25 real grid corresponding to the Peninsula, the Balearic Islands
and the Canary Islands, adjusted to the new ETRS89 official
reference geodetic system, in geographical coordinates (longitude,
latitude).

- **MTN50_ETRS89_Peninsula_Baleares_Canarias.shp**

MTN50 real grid corresponding to the Peninsula, the Balearic Islands
and the Canary Islands, adjusted to the new ETRS89 official
reference geodetic system, in geographical coordinates (longitude,
latitude).

- **MTN25_RegCan95_Canarias.shp**

MTN25 grid corresponding to the Canary Islands, in REGCAN95 (WGS84
compatible) and geographic coordinates (longitude, latitude). It is
the real MTN25 grid, that is, the one that divides the current
printed series of the map, taking into account the special
distribution of the Canary Islands sheets.

- **MTN50_RegCan95_Canarias.shp**

MTN50 grid corresponding to the Canary Islands, in REGCAN95 (WGS84
compatible) and geographic coordinates (longitude, latitude). This
is the real grid of the MTN50, that is, the one that divides the
current printed series of the map, taking into account the special
distribution of the Canary Islands sheets.

## Table of files

Full reference of each dataset in the [source](./MTN/source) folder.

There are 7 files available:

| file |
|:----------------------------------------------|
| MTN25_ED50_Peninsula_Baleares.gpkg |
| MTN25_ETRS89_ceuta_melilla_alboran.gpkg |
| MTN25_ETRS89_Peninsula_Baleares_Canarias.gpkg |
| MTN25_RegCan95_Canarias.gpkg |
| MTN50_ED50_Peninsula_Baleares.gpkg |
| MTN50_ETRS89_Peninsula_Baleares_Canarias.gpkg |
| MTN50_RegCan95_Canarias.gpkg |

## Preview

<img src="MTN/img/grid-preview-1.png" width="33%" /><img src="MTN/img/grid-preview-2.png" width="33%" /><img src="MTN/img/grid-preview-3.png" width="33%" /><img src="MTN/img/grid-preview-4.png" width="33%" /><img src="MTN/img/grid-preview-5.png" width="33%" /><img src="MTN/img/grid-preview-6.png" width="33%" /><img src="MTN/img/grid-preview-7.png" width="33%" />
67 changes: 67 additions & 0 deletions MTN/create_gpkgs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 1. Config----

rm(list = ls())
library(sf)
library(dplyr)
library(zip)


initwd <- getwd()

setwd("MTN")

# 2. Clean ----

# Clean output dirs

folderfiles <- list.files("dist/")
all <- file.path("dist", folderfiles)
file.remove(all)


# MTN ----

basedir <-
file.path("source")


# List files
shp <- list.files(basedir)
shp <- shp[grep(".shp", shp)]


# Create geopackages

for (i in seq_len(length(shp))) {
path <- file.path(basedir, shp[i])
outpath <- gsub(".shp", ".gpkg", file.path("dist", shp[i]))

if (file.exists(outpath)) {
print(paste0("Skipping ", outpath, ", already in dist"))
next()
}
input <-
st_read(path, stringsAsFactors = FALSE, quiet = TRUE) %>% st_make_valid()

write_sf(input,
outpath,
factorsAsCharacter = FALSE,
overwrite = TRUE
)
}


# 8. Create zip----
# https://stackoverflow.com/questions/23668395/creating-zip-file-from-folders-in-r




files2zip <- dir("dist", full.names = TRUE)
zipr(zipfile = "dist/MTN_grids.zip", files = files2zip)

# Reset wd

setwd(initwd)

rm(list = ls())
Binary file added MTN/dist/MTN25_ED50_Peninsula_Baleares.gpkg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added MTN/dist/MTN25_RegCan95_Canarias.gpkg
Binary file not shown.
Binary file added MTN/dist/MTN50_ED50_Peninsula_Baleares.gpkg
Binary file not shown.
Binary file not shown.
Binary file added MTN/dist/MTN50_RegCan95_Canarias.gpkg
Binary file not shown.
Binary file added MTN/dist/MTN_grids.zip
Binary file not shown.
Binary file added MTN/img/grid-preview-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/img/grid-preview-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/img/grid-preview-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/img/grid-preview-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/img/grid-preview-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/img/grid-preview-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MTN/img/grid-preview-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5e53d64

Please sign in to comment.