Skip to content

Commit

Permalink
Merge pull request #55 from CityRiverSpaces/43-readme-example-cf
Browse files Browse the repository at this point in the history
Add example code in README
  • Loading branch information
cforgaci authored Jan 15, 2025
2 parents 2f53f00 + 892ad2e commit 85ec2ac
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
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.

0 comments on commit 85ec2ac

Please sign in to comment.