Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utiliser la géométrie simplifiée de la BDD #67

Open
6 tasks done
statnmap opened this issue Dec 1, 2021 · 4 comments
Open
6 tasks done

Utiliser la géométrie simplifiée de la BDD #67

statnmap opened this issue Dec 1, 2021 · 4 comments
Assignees

Comments

@statnmap
Copy link
Collaborator

statnmap commented Dec 1, 2021

Validation

  • L'app Shiny utilise la couche "simplified_geom" for v_basin
  • L'app Shiny utilise la couche "simplified_geom" for v_ices_geom
  • Page 1 still shows frontiers

Technicals

  • Page 1 does show frontiers at low resolution
  • diadesatlas.v_basin: utiliser la géométrie simplifiée de la BDD et non pas en refaire une dans l'app (ne pas utiliser ms_simplify())
  • diadesatlas.v_ices_geom: utiliser la géométrie simplifiée de la BDD et non pas en refaire une dans l'app (ne pas utiliser ms_simplify())
@ColinFay
Copy link
Collaborator

ColinFay commented Dec 8, 2021

@statnmap
Copy link
Collaborator Author

De Eric:
La vue v_basin affiche la colonne verysimplified_geom :

CREATE VIEW diadesatlas.v_basin AS
 SELECT DISTINCT basin.basin_id,
    basin.basin_name,
    bo.verysimplified_geom AS geom
   FROM ((diadesatlas.basin
     JOIN diadesatlas.basin_outlet bo USING (basin_id))
     JOIN diadesatlas.abundance a USING (basin_id));

Quant à la vue v_ices_geom, elle utilise "simplified_geom" pour les divisions, qui sont les plus grosses. Les rectangles sont laissés tels quels :

CREATE VIEW diadesatlas.v_ices_geom AS
 SELECT 'division'::text AS ices_type,
    ices_area.gid,
    ices_area.area_full AS icesname,
    ices_area.simplified_geom AS geom
   FROM diadesatlas.ices_area
UNION
 SELECT 'rectangle'::text AS ices_type,
    ices_rectangle.gid,
    ices_rectangle.icesname,
    ices_rectangle.geom
   FROM diadesatlas.ices_rectangle;

C'est dans la version du 20 octobre.

ALanguillaume added a commit that referenced this issue Jun 2, 2022
Why?

- Simplification already made in database.

What?

- Remove call to ms_simplify()

Issues #67
ALanguillaume added a commit that referenced this issue Jun 2, 2022
Why?

- Two polygons have invalid geometry in current db version.

What?

- Add reprex in data exploration vignette

Issues #67
@ALanguillaume
Copy link
Collaborator

L'application fonctionne bien avec la geometrie de la colonne verysimplified_geom pour la vue v_basin.

Cependant je me suis rendu compte en enlevant la simplifcation de la geometrie côté R pour la vue v_ices_geom que deux des polygons avaient des geometries invalides.

J'ai documenté cela dans data-raw/aa-a-exploration_data.Rmd.

@statnmap
Copy link
Collaborator Author

statnmap commented Jun 8, 2022

Après connexion à la base de données, vous pouvez exécuter ces lignes de code.
Vous verrez que la carte {tmap} ne peut pas être créée à cause de problèmes de géométrie.

Si vous dé-commentez %>% rmapshaper::ms_simplify(),la géométrie est simplifiée et corrigée.

Peut-être avez-vous moyen d'éviter les problèmes de géométrie avant de mettre dans la base, sinon, on reste sur une double simplification: la votre dans la base + la notre dans R

## Reprex invalid ices_geom
```{r}
library(sf)
library(dplyr)
library(tmap)
```

Two polygons of ices_geom have invalid geometries.

```{r}
ices_geom <- st_read(
  conn_eurodiad,
  query = "SELECT * FROM diadesatlas.v_ices_geom;"
) %>%
  st_transform("+proj=wintri") #%>%
# rmapshaper::ms_simplify()
```


```{r}
invalid_pols <- ices_geom %>% 
  filter(!st_is_valid(.))
nrow(invalid_pols)
```

This makes the interactive map fails.

```{r, error=TRUE}
map_invalid <- tm_shape(invalid_pols)+
  tm_sf()
tmap_leaflet(map_invalid)
```

@statnmap statnmap assigned PMHLambert and unassigned ALanguillaume Feb 9, 2023
PMHLambert added a commit that referenced this issue Mar 21, 2023
st_make_valid is now useless since  geometries are valid in the
database. #67
PMHLambert added a commit that referenced this issue Mar 21, 2023
since frontiers have been removed from tm_draw, need to display
frontiers in static maps #67
@statnmap statnmap mentioned this issue Mar 21, 2023
8 tasks
PMHLambert added a commit that referenced this issue Apr 19, 2023
PMHLambert added a commit that referenced this issue Apr 24, 2023
test merged geometries for case studies #67
display name of the geometry #153
PMHLambert added a commit that referenced this issue Apr 28, 2023
The ICES rectangles do not include the coasts.

issue: #67
PMHLambert added a commit that referenced this issue May 4, 2023
The ICES rectangles do not include the coasts.

issue: #67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants