Skip to content

Commit

Permalink
Add tests for duplicated ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Nov 15, 2023
1 parent 697d2f9 commit b5eb6e9
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions data-raw/test_points_to_od.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
format: gfm
---

```{bash}
#| eval: false
# Get data from the web
gh release
```


```{r}
#| eval: false
piggyback::pb_list(repo = "itsleeds/atumie")
piggyback::pb_download("zones_test.gpkg", repo = "itsleeds/atumie")
piggyback::pb_download("social_grid.gpkg", repo = "itsleeds/atumie")
piggyback::pb_upload("zones_test.gpkg")
piggyback::pb_upload("social_grid.gpkg")
# Get urls from v0.0.5 release:
url_zones = "https://github.com/Robinlovelace/simodels/releases/download/v0.0.5/zones_test.gpkg"
f_zones = basename(url_zones)
download.file(url_zones, f_zones)
url_grid = "https://github.com/Robinlovelace/simodels/releases/download/v0.0.5/social_grid.gpkg"
download.file(url_grid, basename(url_grid))
```

```{r}
url_zones = "https://github.com/Robinlovelace/simodels/releases/download/v0.0.5/zones_test.gpkg"
zones = sf::read_sf(url_zones)
url_grid = "https://github.com/Robinlovelace/simodels/releases/download/v0.0.5/social_grid.gpkg"
grid = sf::read_sf(url_grid)
plot(zones$geom)
plot(grid$geom, add = TRUE, col = "red")
```

```{r}
devtools::load_all()
od = points_to_od(zones, grid)
zonesp = sf::st_centroid(zones)
gridp = sf::st_centroid(grid)
odp = points_to_od(zonesp, gridp)
zonesg = sf::st_sf(
sf::st_drop_geometry(zones),
geometry = zones$geom
)
gridg = sf::st_sf(
sf::st_drop_geometry(grid),
geometry = grid$geom
)
odp = points_to_od(zonesg, gridg)
```

0 comments on commit b5eb6e9

Please sign in to comment.