diff --git a/README.Rmd b/README.Rmd index a298b75..390b5ae 100644 --- a/README.Rmd +++ b/README.Rmd @@ -21,9 +21,14 @@ knitr::opts_chunk$set( -The goal of geoprofiler is to get distances along and across user-defined profile lines or transects. This is useful when variables depend on distances. +The goal of geoprofiler is to get distances along and across user-defined +profile lines or transects. This is useful when variables depend on distances. -![Concept: geoprofiler applies a coordinate transformation of your geo-coordinates into "profile coordinates'. These coordinates are the distances along and across your profile.](man/figures/fig.png) +![](man/figures/fig.png) + +The concept of geoprofiler is a coordinate transformation of your +geo-coordinates into "profile coordinates". These coordinates are the +distances along and across your profile. ## Installation @@ -82,7 +87,8 @@ ggplot(quakes_profile, aes(X, depth, color = mag, size = abs(Y), alpha = abs(Y)) theme_classic() ``` -The above example uses the `quakes` dataset giving the locations of 1000 seismic events of MB \> 4.0. The events occurred in a cube near Fiji since 1964. +The above example uses the `quakes` dataset giving the locations of 1000 seismic +events of MB \> 4.0. The events occurred in a cube near Fiji since 1964. ## Documentation @@ -94,7 +100,9 @@ Tobias Stephan ([tstephan\@lakeheadu.ca](mailto:tstephan@lakeheadu.ca){.email}) ## Feedback, issues, and contributions -I welcome feedback, suggestions, issues, and contributions! If you have found a bug, please file it [here](https://github.com/tobiste/geoprofiler/issues) with minimal code to reproduce the issue. +I welcome feedback, suggestions, issues, and contributions! If you have found a +bug, please file it [here](https://github.com/tobiste/geoprofiler/issues) with +minimal code to reproduce the issue. ## License diff --git a/README.md b/README.md index 9b67ed4..1fd9c00 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,11 @@ The goal of geoprofiler is to get distances along and across user-defined profile lines or transects. This is useful when variables depend on distances. -
- - -
+![](man/figures/fig.png) + +The concept of geoprofiler is a coordinate transformation of your +geo-coordinates into “profile coordinates”. These coordinates are the +distances along and across your profile. ## Installation diff --git a/vignettes/geoprofiler.Rmd b/vignettes/geoprofiler.Rmd index 78321c6..ea84003 100644 --- a/vignettes/geoprofiler.Rmd +++ b/vignettes/geoprofiler.Rmd @@ -35,18 +35,19 @@ options(ggplot2.continuous.fill = "viridis") You can use any spatial data that can be converted into a `sf` object. If you have a shape file for example, simply import it into R using the function -```{r read, eval=FALSE,echo=FALSE} +```{r read, eval=FALSE, include=TRUE} my_data <- sf::read_sf('path/to/my/file.shp') ``` -For this tutorial we use the `quakes` dataset (from R's 'datasets` package) +For this tutorial we use the `quakes` dataset (from R's `datasets` package) giving the locations of 1000 seismic events of MB > 4.0. The events occurred in a cube near Fiji since 1964. ```{r load_data} data("quakes") -crs <- st_crs("EPSG:3460") +crs <- st_crs("EPSG:3460") # coordinate reference system for projection +# Convert to sf object and transform to projected coordinates quakes_sf <- st_as_sf(quakes, coords = c("long", "lat"), crs = "WGS84") |> st_transform(crs = crs) @@ -70,8 +71,8 @@ is more relevant. For example, if the profile should be a line connecting two points: ```{r pts} profile_pts <- data.frame(lon = c(160, -170), lat = c(-15, -24)) |> - st_as_sf(coords = c("lon", "lat"), crs = "WGS84") |> - st_transform(crs = crs) + st_as_sf(coords = c("lon", "lat"), crs = "WGS84") |> # convert to sf object + st_transform(crs = crs) # transform to projected coordinates ``` Combine the two points to a line and add the profile line to the map: @@ -119,7 +120,6 @@ The resulting data-frame gives the distance along the profile (`X`) and the distance from the profile (`Y`). - A quick way to visualize the "transformed" data can be achieved by plotting these axes against each other:: @@ -144,8 +144,8 @@ of the profile has the coordinates `X=0` and `Y=0`. The location of the profile line can be easily shifted to the desired spot by adjusting the `X` and `Y` values of the transformed data. -For example, to shift the profile line more to the 'North', we simply subtract -the desired shift (to move it 'down', we would need to add the desired number). +For example, to shift the profile line more to the "North", we simply subtract +the desired shift (to move it "down", we would need to add the desired number). ```{r shift} quakes_profile_shifted <- quakes_profile |> @@ -178,7 +178,7 @@ quakes_profile_filtered <- filter( ## Plot data along profile -Finally we plot our filtered data against the profile: +Finally, we plot our filtered data against the profile: ```{r profile_plot1} ggplot(quakes_profile_filtered, aes(X, depth, color = depth, size = mag)) + @@ -197,7 +197,7 @@ This gives a somewhat 3-dimensional look to it: ```{r profile_plot2} quakes_profile_shifted |> - arrange(desc(abs(Y))) |> + arrange(desc(abs(Y))) |> # sort data to have close datapoints in foreground ggplot(aes(X, depth, color = mag, size = abs(Y), alpha = abs(Y))) + geom_point() + scale_color_viridis_c("Richter Magnitude", option = "A") +