From afaedd088a226718c2da67e742bc0b66a03a18c7 Mon Sep 17 00:00:00 2001 From: tobiste <73840881+tobiste@users.noreply.github.com> Date: Wed, 4 Dec 2024 02:09:05 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20tobiste/?= =?UTF-8?q?geoprofiler@aa8d5c6fc063a5e8303b981a25e58a8baf509b49=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- articles/geoprofiler.html | 52 ++++++++++-------- .../geoprofiler_files/figure-html/line-1.png | Bin 140940 -> 143494 bytes .../figure-html/load_data-1.png | Bin 136471 -> 136404 bytes .../figure-html/profile_map-1.png | Bin 171060 -> 145001 bytes .../figure-html/profile_plot1-1.png | Bin 169986 -> 141765 bytes .../figure-html/profile_plot2-1.png | Bin 238408 -> 213452 bytes authors.html | 4 +- index.html | 4 +- pkgdown.yml | 2 +- reference/geoprofiler-package.html | 4 +- reference/index.html | 12 ---- reference/profile_azimuth.html | 9 ++- reference/profile_coords-1.png | Bin 57227 -> 57124 bytes reference/profile_coords.html | 6 +- reference/profile_length.html | 6 +- reference/profile_line.html | 10 ++-- reference/profile_points.html | 30 +++++----- search.json | 2 +- sitemap.xml | 2 - 19 files changed, 71 insertions(+), 72 deletions(-) diff --git a/articles/geoprofiler.html b/articles/geoprofiler.html index f7dd98e..59c3ea1 100644 --- a/articles/geoprofiler.html +++ b/articles/geoprofiler.html @@ -69,7 +69,7 @@
data("quakes")
+crs <- st_crs("EPSG:3460")
-quakes_sf <- st_as_sf(quakes, coords = c("long", "lat"), crs = "WGS84")
+quakes_sf <- st_as_sf(quakes, coords = c("long", "lat"), crs = "WGS84") |>
+ st_transform(crs = crs)
quake_map <- ggplot() +
geom_sf(aes(color = depth, size = mag), data = quakes_sf) +
- scale_color_viridis_c() +
scale_size_binned() +
- theme_classic() +
- coord_sf(xlim = c(160, 195))
+ theme_classic()
quake_map
+> Transform your dataset into a projected cooridnate reference system +to deal with units such as m, km, miles etc. Otherwise the units will be +in degrees.
profile_pts <- data.frame(lon = c(160, -170), lat = c(-15, -24)) |>
st_as_sf(coords = c("lon", "lat"), crs = "WGS84") |>
- st_shift_longitude()
Combine the two points to a line and add the profile line to the map:
profile_l <- profile_line(profile_pts)
quake_map +
- geom_sf(data = profile_l, lty = 2)
-#> Coordinate system already present. Adding new coordinate system, which will
-#> replace the existing one.
profile_azimuth(profile_l)
#> 112.3832 [°]
profile_length(profile_l)
-#> 3291737 [m]
data.frame(lon = 160, lat = 15) |>
st_as_sf(coords = c("lon", "lat"), crs = "WGS84") |>
- st_shift_longitude() |>
- profile_points(profile.azimuth = 112, profile.length = set_units(50, degree))
+ st_transform(crs = crs) |>
+ profile_points(profile.azimuth = 112, profile.length = set_units(8000, km))
#> Simple feature collection with 2 features and 0 fields
#> Geometry type: POINT
#> Dimension: XY
-#> Bounding box: xmin: 160 ymin: -31.35919 xmax: 178.7303 ymax: 15
-#> Geodetic CRS: WGS 84
-#> geometry
-#> 1 POINT (160 15)
-#> 2 POINT (178.7303 -31.35919)
Note that the unit of
profile.length
depends on the coordinate reference system and must be in degree for lon-lat @@ -161,9 +162,12 @@Determine the dist plotting these axes against each other::
+ geom_point() + + scale_x_continuous(breaks = seq(0, 3000, 250)) + + scale_y_continuous(breaks = seq(-3000, 3000, 250)) + + coord_fixed()quakes_profile |> - ggplot(aes(X, Y, color = depth)) + + ggplot(aes(X / 1000, Y / 1000, color = depth)) + geom_hline(yintercept = 0) + - geom_point()
In this plot the profile line is a horizontal line (
@@ -172,8 +176,8 @@X=0
).Determine the dist
quakes_profile_filtered <- filter( quakes_profile, - abs(Y) <= 10, - X <= 7 + abs(Y) <= 750 * 1000, + X >= 1500 * 1000 )
@@ -186,7 +190,7 @@+ labs(x = "Distance along profile (m)", y = "Depth (km)", color = "Depth (km)")Plot data along profile scale_size_binned("Richter Magnitude") + scale_y_reverse() + scale_x_continuous(guide = guide_axis(position = "top")) + - labs(x = "Distance along profile (degree)", y = "Depth (km)", color = "Depth (km)")
One way to show the distance from the profile in the same plot is by controlling the size (and/or the opacity) of the points. Here I am using @@ -200,7 +204,7 @@
Plot data along profile scale_alpha_continuous("Distance from profile (degree)", range = c(1, .1)) + scale_y_reverse() + scale_x_continuous(guide = guide_axis(position = "top")) + - labs(x = "Distance along profile (degree)", y = "Depth (km)") + labs(x = "Distance along profile (m)", y = "Depth (km)")