Skip to content

Commit

Permalink
docs: add more about CRS
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Nov 5, 2024
1 parent 027912c commit 1916b95
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion vignettes/articles/request-params.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ emodnet_get_layers(

## Limit spatial extent using a boundary box

The `bbox` parameter allows us to search for features that are contained (or partially contained) inside a box of user-defined coordinates. The format of the `bbox` parameter in most EMODnet WFS cases (assuming you are using version `2.0.0`) is `bbox=a1,b1,a2,b2,[crs]` where `a1`, `b1`, `a2`, and `b2` represent the coordinate values. The optional `crs` parameter is used to name the CRS for the bbox coordinates (if they are different to the featureTypes native CRS.) The order of coordinates passed to the `bbox` parameter depends on the coordinate system used (this is why the coordinate syntax isn’t represented with `x` or `y`).
The `bbox` parameter allows us to search for features that are contained (or partially contained) inside a box of user-defined coordinates. The format of the `bbox` parameter in most EMODnet WFS cases (assuming you are using version `2.0.0`) is `bbox=a1,b1,a2,b2,[crs]` where `a1`, `b1`, `a2`, and `b2` represent the coordinate values. The optional `crs` parameter is used to name the coordinate reference system (CRS) for the bbox coordinates (if they are different to the featureTypes native CRS.) The order of coordinates passed to the `bbox` parameter depends on the coordinate system used (this is why the coordinate syntax isn’t represented with `x` or `y`).

In the following example, we specify the bounding box by proving coordinates in the order `xmin,ymin,xmax,ymax` and specifying that coordinates are given in the `EPSG:4326` coordinate reference system.

Expand Down
57 changes: 30 additions & 27 deletions vignettes/emodnet.wfs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,27 @@ The column `service_name` shows services available, while `service_url` has the

``` r
seabed_wfs_client <- emodnet_init_wfs_client(service = "seabed_habitats_general_datasets_and_products")
#> Loading ISO 19139 XML schemas...
#> Loading ISO 19115 codelists...
#> ✔ WFS client created successfully
#> ℹ Service: "https://ows.emodnet-seabedhabitats.eu/geoserver/emodnet_open/wfs"
#> ℹ Version: "2.0.0"

emodnet_get_wfs_info(wfs = seabed_wfs_client)
#> # A tibble: 72 × 9
#> # Rowwise:
#> data_source service_name service_url layer_name title abstract class format
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 2 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 3 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 4 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 5 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 6 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 7 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 8 emodnet_wfs seabed_habitats_general_da… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 9 emodnet_wfs seabed_habitats_general_da… https://ow… carib_eus… 2023… "Output… WFSF… sf
#> 10 emodnet_wfs seabed_habitats_general_da… https://ow… biogenic_… Biog… "This l… WFSF… sf
#> data_source service_name service_url layer_name title abstract class format
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 2 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 3 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 4 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 5 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 6 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 7 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 8 emodnet_wfs seabed_habitat… https://ow… art17_hab… 2013… "Gridde… WFSF… sf
#> 9 emodnet_wfs seabed_habitat… https://ow… carib_eus… 2023… "Output… WFSF… sf
#> 10 emodnet_wfs seabed_habitat… https://ow… biogenic_… Biog… "This l… WFSF… sf
#> # ℹ 62 more rows
#> # ℹ 1 more variable: layer_namespace <chr>
```
Expand All @@ -131,16 +133,17 @@ emodnet_get_layer_info(
)
#> # A tibble: 3 × 9
#> # Rowwise:
#> data_source service_name service_url layer_name title abstract class format layer_namespace
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 emodnet_wfs https://ows… seabed_hab… art17_hab… 2013… "Gridde… WFSF… sf emodnet_open
#> 2 emodnet_wfs https://ows… seabed_hab… art17_hab… 2013… "Gridde… WFSF… sf emodnet_open
#> 3 emodnet_wfs https://ows… seabed_hab… art17_hab… 2013… "Gridde… WFSF… sf emodnet_open
#> data_source service_name service_url layer_name title abstract class format
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 emodnet_wfs https://ows.emo… seabed_hab… art17_hab… 2013… "Gridde… WFSF… sf
#> 2 emodnet_wfs https://ows.emo… seabed_hab… art17_hab… 2013… "Gridde… WFSF… sf
#> 3 emodnet_wfs https://ows.emo… seabed_hab… art17_hab… 2013… "Gridde… WFSF… sf
#> # ℹ 1 more variable: layer_namespace <chr>
```



We are now ready to read the layers into R with `emodnet_get_layers()`. emodnet.wfs reads the geometries as simple features (See `sf` package) transformed to [4326](https://epsg.io/4326) by default. Specifying another map projection is possible by passing a EPGS code or projection string with `emodnet_get_layers(crs = "your projection")`. The argument `reduce_layers = TRUE` stack all the layers in one single tibble. Default is FALSE and returns a list of sf objects, one per layer.
We are now ready to read the layers into R with `emodnet_get_layers()`. emodnet.wfs reads the geometries as simple features (See `sf` package) transformed to [4326](https://epsg.io/4326) by default. Specifying another map projection is possible by passing a EPGS code or projection string with `emodnet_get_layers(crs = "your projection")` where crs is a coordinate reference system (CRS). The argument `reduce_layers = TRUE` stack all the layers in one single tibble. Default is FALSE and returns a list of sf objects, one per layer.


``` r
Expand All @@ -156,15 +159,15 @@ class(habitats_directive_layers)
glimpse(habitats_directive_layers)
#> Rows: 221
#> Columns: 9
#> $ gml_id <chr> "art17_hab_1110.13", "art17_hab_1110.22", "art17_hab_1110.25",
#> $ habitat_code <chr> "1110", "1110", "1110", "1110", "1110", "1110", "1110", "1110",
#> $ ms <chr> "DK", "ES", "ES", "PT", "PT", "PL", "DK", "FR", "UK", "BE", "BE
#> $ region <chr> "ATL", "MAC", "MMAC", "MMAC", "MATL", "MBAL", "MBAL", "MATL", "
#> $ cs_ms <chr> "U2+", "U1+", "U1+", "XX", "U1-", "U1-", "U1-", "U1x", "U1x", "
#> $ country_code <chr> "Denmark", "Spain", "Spain", "Portugal", "Portugal", "Poland",
#> $ habitat_code_uri <chr> "http://dd.eionet.europa.eu/vocabulary/art17_2018/habitats/1110
#> $ habitat_description <chr> "Sandbanks which are slightly covered by sea water all the time
#> $ geom <MULTISURFACE [m]> MULTISURFACE (POLYGON ((420..., MULTISURFACE (POLY
#> $ gml_id <chr> "art17_hab_1110.13", "art17_hab_1110.22", "art17_ha
#> $ habitat_code <chr> "1110", "1110", "1110", "1110", "1110", "1110", "11
#> $ ms <chr> "DK", "ES", "ES", "PT", "PT", "PL", "DK", "FR", "UK…
#> $ region <chr> "ATL", "MAC", "MMAC", "MMAC", "MATL", "MBAL", "MBAL…
#> $ cs_ms <chr> "U2+", "U1+", "U1+", "XX", "U1-", "U1-", "U1-", "U1
#> $ country_code <chr> "Denmark", "Spain", "Spain", "Portugal", "Portugal"…
#> $ habitat_code_uri <chr> "http://dd.eionet.europa.eu/vocabulary/art17_2018/h
#> $ habitat_description <chr> "Sandbanks which are slightly covered by sea water …
#> $ geom <MULTISURFACE [m]> MULTISURFACE (POLYGON ((420..., MULTIS
```


Expand Down
2 changes: 1 addition & 1 deletion vignettes/emodnet.wfs.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ emodnet_get_layer_info(



We are now ready to read the layers into R with `emodnet_get_layers()`. emodnet.wfs reads the geometries as simple features (See `sf` package) transformed to [4326](https://epsg.io/4326) by default. Specifying another map projection is possible by passing a EPGS code or projection string with `emodnet_get_layers(crs = "your projection")`. The argument `reduce_layers = TRUE` stack all the layers in one single tibble. Default is FALSE and returns a list of sf objects, one per layer.
We are now ready to read the layers into R with `emodnet_get_layers()`. emodnet.wfs reads the geometries as simple features (See `sf` package) transformed to [4326](https://epsg.io/4326) by default. Specifying another map projection is possible by passing a EPGS code or projection string with `emodnet_get_layers(crs = "your projection")` where crs is a coordinate reference system (CRS). The argument `reduce_layers = TRUE` stack all the layers in one single tibble. Default is FALSE and returns a list of sf objects, one per layer.

```{r}
habitats_directive_layers <- emodnet_get_layers(
Expand Down

0 comments on commit 1916b95

Please sign in to comment.