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

Add example code in README #55

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,22 @@ This is a basic example which shows you how to solve a common problem:

```{r example}
library(CRiSp)
## basic example code

# Set location parameters
city_name <- "Bucharest"
river_name <- "Dâmbovița"
epsg_code <- 32635

# Get base layer for plotting
bucharest_bb <- get_osm_bb(city_name)
bucharest_streets <- get_osm_streets(bucharest_bb, epsg_code)[, "geometry"]

# Delineate river corridor
bucharest_river <- delineate_corridor("Bucharest", "Dâmbovița", epsg_code)

# Plot results
plot(bucharest_river, border = "orange", lwd = 3)
plot(bucharest_streets, add = TRUE)
```

## Contributing
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,28 @@ This is a basic example which shows you how to solve a common problem:

``` r
library(CRiSp)
## basic example code

# Set location parameters
city_name <- "Bucharest"
river_name <- "Dâmbovița"
epsg_code <- 32635

# Get base layer for plotting
bucharest_bb <- get_osm_bb(city_name)
bucharest_streets <- get_osm_streets(bucharest_bb, epsg_code)[, "geometry"]

# Delineate river corridor
bucharest_river <- delineate_corridor("Bucharest", "Dâmbovița", epsg_code)
#> Warning: to_spatial_subdivision assumes attributes are constant over geometries
#> Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE

# Plot results
plot(bucharest_river, border = "orange", lwd = 3)
plot(bucharest_streets, add = TRUE)
```

<img src="man/figures/README-example-1.png" width="100%" />

## Contributing

We look very much forward to contributions to the package. See the
Expand All @@ -38,3 +57,4 @@ We look very much forward to contributions to the package. See the
This package is released with a [Contributor Code of
Conduct](.github/CODE_OF_CONDUCT.md). By contributing to this project
you agree to abide by its terms.

Binary file added man/figures/README-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading