diff --git a/pkgdown.yml b/pkgdown.yml index fc30f6a..0ad21c0 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,4 +3,4 @@ pkgdown: 2.1.0 pkgdown_sha: ~ articles: od: od.html -last_built: 2024-08-19T23:53Z +last_built: 2024-08-20T00:05Z diff --git a/reference/Rplot002.png b/reference/Rplot002.png index 1255d04..72f3e73 100644 Binary files a/reference/Rplot002.png and b/reference/Rplot002.png differ diff --git a/reference/od_interzone.html b/reference/od_interzone.html index cfc30a1..4d5ad18 100644 --- a/reference/od_interzone.html +++ b/reference/od_interzone.html @@ -79,7 +79,6 @@ <h2>Arguments</h2> <h2>Examples</h2> <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span></span></span> <span class="r-in"><span><span class="va">od_data</span> <span class="op">=</span> <span class="fu"><a href="points_to_od.html">points_to_od</a></span><span class="op">(</span><span class="va">od_data_centroids</span><span class="op">)</span></span></span> -<span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> <span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">nrow</a></span><span class="op">(</span><span class="va">od_data</span><span class="op">)</span></span></span> <span class="r-out co"><span class="r-pr">#></span> [1] 11449</span> <span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">nrow</a></span><span class="op">(</span><span class="fu">od_interzone</span><span class="op">(</span><span class="va">od_data</span><span class="op">)</span><span class="op">)</span></span></span> diff --git a/reference/points_to_od-1.png b/reference/points_to_od-1.png index 42208cc..7fbc4b4 100644 Binary files a/reference/points_to_od-1.png and b/reference/points_to_od-1.png differ diff --git a/reference/points_to_od-2.png b/reference/points_to_od-2.png index e62fb82..1d17baa 100644 Binary files a/reference/points_to_od-2.png and b/reference/points_to_od-2.png differ diff --git a/reference/points_to_od.html b/reference/points_to_od.html index 8b34056..6f03b47 100644 --- a/reference/points_to_od.html +++ b/reference/points_to_od.html @@ -133,63 +133,57 @@ <h2>Examples</h2> <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://r-spatial.github.io/sf/" class="external-link">sf</a></span><span class="op">)</span></span></span> <span class="r-in"><span><span class="va">p</span> <span class="op">=</span> <span class="va">od_data_centroids</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</span>, <span class="op">]</span></span></span> <span class="r-in"><span><span class="fu">points_to_od</span><span class="op">(</span><span class="va">p</span><span class="op">)</span></span></span> -<span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> -<span class="r-out co"><span class="r-pr">#></span> O D ox oy dx dy</span> +<span class="r-out co"><span class="r-pr">#></span> Var1 Var2 ox oy dx dy</span> <span class="r-out co"><span class="r-pr">#></span> 1 E02002407 E02002407 -1.609934 53.79079 -1.609934 53.79079</span> -<span class="r-out co"><span class="r-pr">#></span> 1.1 E02002407 E02002353 -1.609934 53.79079 -1.518058 53.84066</span> -<span class="r-out co"><span class="r-pr">#></span> 1.2 E02002407 E02002336 -1.609934 53.79079 -1.624630 53.88605</span> -<span class="r-out co"><span class="r-pr">#></span> 2 E02002336 E02002336 -1.624630 53.88605 -1.624630 53.88605</span> -<span class="r-out co"><span class="r-pr">#></span> 2.1 E02002336 E02002353 -1.624630 53.88605 -1.518058 53.84066</span> -<span class="r-out co"><span class="r-pr">#></span> 2.2 E02002336 E02002407 -1.624630 53.88605 -1.609934 53.79079</span> -<span class="r-out co"><span class="r-pr">#></span> 3 E02002353 E02002353 -1.518058 53.84066 -1.518058 53.84066</span> -<span class="r-out co"><span class="r-pr">#></span> 3.1 E02002353 E02002407 -1.518058 53.84066 -1.609934 53.79079</span> -<span class="r-out co"><span class="r-pr">#></span> 3.2 E02002353 E02002336 -1.518058 53.84066 -1.624630 53.88605</span> +<span class="r-out co"><span class="r-pr">#></span> 2 E02002336 E02002407 -1.624630 53.88605 -1.609934 53.79079</span> +<span class="r-out co"><span class="r-pr">#></span> 3 E02002353 E02002407 -1.518058 53.84066 -1.609934 53.79079</span> +<span class="r-out co"><span class="r-pr">#></span> 1.1 E02002407 E02002336 -1.609934 53.79079 -1.624630 53.88605</span> +<span class="r-out co"><span class="r-pr">#></span> 2.1 E02002336 E02002336 -1.624630 53.88605 -1.624630 53.88605</span> +<span class="r-out co"><span class="r-pr">#></span> 3.1 E02002353 E02002336 -1.518058 53.84066 -1.624630 53.88605</span> +<span class="r-out co"><span class="r-pr">#></span> 1.2 E02002407 E02002353 -1.609934 53.79079 -1.518058 53.84066</span> +<span class="r-out co"><span class="r-pr">#></span> 2.2 E02002336 E02002353 -1.624630 53.88605 -1.518058 53.84066</span> +<span class="r-out co"><span class="r-pr">#></span> 3.2 E02002353 E02002353 -1.518058 53.84066 -1.518058 53.84066</span> <span class="r-in"><span><span class="fu">points_to_od</span><span class="op">(</span><span class="va">p</span>, ids_only <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span> -<span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> -<span class="r-out co"><span class="r-pr">#></span> O D</span> +<span class="r-out co"><span class="r-pr">#></span> Var1 Var2</span> <span class="r-out co"><span class="r-pr">#></span> 1 E02002407 E02002407</span> -<span class="r-out co"><span class="r-pr">#></span> 2 E02002407 E02002353</span> -<span class="r-out co"><span class="r-pr">#></span> 3 E02002407 E02002336</span> -<span class="r-out co"><span class="r-pr">#></span> 4 E02002336 E02002336</span> -<span class="r-out co"><span class="r-pr">#></span> 5 E02002336 E02002353</span> -<span class="r-out co"><span class="r-pr">#></span> 6 E02002336 E02002407</span> -<span class="r-out co"><span class="r-pr">#></span> 7 E02002353 E02002353</span> -<span class="r-out co"><span class="r-pr">#></span> 8 E02002353 E02002407</span> -<span class="r-out co"><span class="r-pr">#></span> 9 E02002353 E02002336</span> +<span class="r-out co"><span class="r-pr">#></span> 2 E02002336 E02002407</span> +<span class="r-out co"><span class="r-pr">#></span> 3 E02002353 E02002407</span> +<span class="r-out co"><span class="r-pr">#></span> 4 E02002407 E02002336</span> +<span class="r-out co"><span class="r-pr">#></span> 5 E02002336 E02002336</span> +<span class="r-out co"><span class="r-pr">#></span> 6 E02002353 E02002336</span> +<span class="r-out co"><span class="r-pr">#></span> 7 E02002407 E02002353</span> +<span class="r-out co"><span class="r-pr">#></span> 8 E02002336 E02002353</span> +<span class="r-out co"><span class="r-pr">#></span> 9 E02002353 E02002353</span> <span class="r-in"><span><span class="op">(</span><span class="va">l</span> <span class="op">=</span> <span class="fu">points_to_odl</span><span class="op">(</span><span class="va">p</span>, interzone_only <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></span></span> -<span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> <span class="r-out co"><span class="r-pr">#></span> Simple feature collection with 6 features and 2 fields</span> <span class="r-out co"><span class="r-pr">#></span> Geometry type: LINESTRING</span> <span class="r-out co"><span class="r-pr">#></span> Dimension: XY</span> <span class="r-out co"><span class="r-pr">#></span> Bounding box: xmin: -1.62463 ymin: 53.79079 xmax: -1.518058 ymax: 53.88605</span> <span class="r-out co"><span class="r-pr">#></span> Geodetic CRS: WGS 84</span> -<span class="r-out co"><span class="r-pr">#></span> O D geometry</span> -<span class="r-out co"><span class="r-pr">#></span> 1 E02002407 E02002353 LINESTRING (-1.609934 53.79...</span> -<span class="r-out co"><span class="r-pr">#></span> 2 E02002407 E02002336 LINESTRING (-1.609934 53.79...</span> -<span class="r-out co"><span class="r-pr">#></span> 3 E02002336 E02002353 LINESTRING (-1.62463 53.886...</span> -<span class="r-out co"><span class="r-pr">#></span> 4 E02002336 E02002407 LINESTRING (-1.62463 53.886...</span> -<span class="r-out co"><span class="r-pr">#></span> 5 E02002353 E02002407 LINESTRING (-1.518058 53.84...</span> -<span class="r-out co"><span class="r-pr">#></span> 6 E02002353 E02002336 LINESTRING (-1.518058 53.84...</span> +<span class="r-out co"><span class="r-pr">#></span> Var1 Var2 geometry</span> +<span class="r-out co"><span class="r-pr">#></span> 1 E02002336 E02002407 LINESTRING (-1.62463 53.886...</span> +<span class="r-out co"><span class="r-pr">#></span> 2 E02002353 E02002407 LINESTRING (-1.518058 53.84...</span> +<span class="r-out co"><span class="r-pr">#></span> 3 E02002407 E02002336 LINESTRING (-1.609934 53.79...</span> +<span class="r-out co"><span class="r-pr">#></span> 4 E02002353 E02002336 LINESTRING (-1.518058 53.84...</span> +<span class="r-out co"><span class="r-pr">#></span> 5 E02002407 E02002353 LINESTRING (-1.609934 53.79...</span> +<span class="r-out co"><span class="r-pr">#></span> 6 E02002336 E02002353 LINESTRING (-1.62463 53.886...</span> <span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">l</span><span class="op">)</span></span></span> <span class="r-plt img"><img src="points_to_od-1.png" alt="" width="700" height="433"></span> <span class="r-in"><span><span class="fu">points_to_od</span><span class="op">(</span><span class="va">od_data_centroids</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, <span class="op">]</span>, <span class="va">od_data_centroids</span><span class="op">[</span><span class="fl">3</span>, <span class="op">]</span><span class="op">)</span></span></span> -<span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> -<span class="r-out co"><span class="r-pr">#></span> O D ox oy dx dy</span> +<span class="r-out co"><span class="r-pr">#></span> Var1 Var2 ox oy dx dy</span> <span class="r-out co"><span class="r-pr">#></span> 1 E02002407 E02002353 -1.609934 53.79079 -1.518058 53.84066</span> <span class="r-out co"><span class="r-pr">#></span> 2 E02002336 E02002353 -1.624630 53.88605 -1.518058 53.84066</span> <span class="r-in"><span><span class="va">l</span> <span class="op">=</span> <span class="fu">points_to_odl</span><span class="op">(</span><span class="va">od_data_centroids</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, <span class="op">]</span>, <span class="va">od_data_centroids</span><span class="op">[</span><span class="fl">3</span>, <span class="op">]</span><span class="op">)</span></span></span> -<span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> <span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">l</span><span class="op">)</span></span></span> <span class="r-plt img"><img src="points_to_od-2.png" alt="" width="700" height="433"></span> <span class="r-in"><span><span class="op">(</span><span class="va">od</span> <span class="op">=</span> <span class="fu">points_to_od</span><span class="op">(</span><span class="va">p</span>, interzone_only <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></span></span> -<span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> -<span class="r-out co"><span class="r-pr">#></span> O D ox oy dx dy</span> -<span class="r-out co"><span class="r-pr">#></span> 2 E02002407 E02002353 -1.609934 53.79079 -1.518058 53.84066</span> -<span class="r-out co"><span class="r-pr">#></span> 3 E02002407 E02002336 -1.609934 53.79079 -1.624630 53.88605</span> -<span class="r-out co"><span class="r-pr">#></span> 5 E02002336 E02002353 -1.624630 53.88605 -1.518058 53.84066</span> -<span class="r-out co"><span class="r-pr">#></span> 6 E02002336 E02002407 -1.624630 53.88605 -1.609934 53.79079</span> -<span class="r-out co"><span class="r-pr">#></span> 8 E02002353 E02002407 -1.518058 53.84066 -1.609934 53.79079</span> -<span class="r-out co"><span class="r-pr">#></span> 9 E02002353 E02002336 -1.518058 53.84066 -1.624630 53.88605</span> +<span class="r-out co"><span class="r-pr">#></span> Var1 Var2 ox oy dx dy</span> +<span class="r-out co"><span class="r-pr">#></span> 2 E02002336 E02002407 -1.624630 53.88605 -1.609934 53.79079</span> +<span class="r-out co"><span class="r-pr">#></span> 3 E02002353 E02002407 -1.518058 53.84066 -1.609934 53.79079</span> +<span class="r-out co"><span class="r-pr">#></span> 4 E02002407 E02002336 -1.609934 53.79079 -1.624630 53.88605</span> +<span class="r-out co"><span class="r-pr">#></span> 6 E02002353 E02002336 -1.518058 53.84066 -1.624630 53.88605</span> +<span class="r-out co"><span class="r-pr">#></span> 7 E02002407 E02002353 -1.609934 53.79079 -1.518058 53.84066</span> +<span class="r-out co"><span class="r-pr">#></span> 8 E02002336 E02002353 -1.624630 53.88605 -1.518058 53.84066</span> <span class="r-in"><span><span class="va">l2</span> <span class="op">=</span> <span class="fu"><a href="od_to_sf.html">od_to_sf</a></span><span class="op">(</span><span class="va">od</span>, <span class="va">od_data_centroids</span><span class="op">)</span></span></span> <span class="r-msg co"><span class="r-pr">#></span> 0 origins with no match in zone ids</span> <span class="r-msg co"><span class="r-pr">#></span> 0 destinations with no match in zone ids</span> @@ -207,29 +201,19 @@ <h2>Examples</h2> <span class="r-out co"><span class="r-pr">#></span> 2 E02002336 E02002407 -3.234564 107.6768 -3.234564 107.6768 2</span> <span class="r-out co"><span class="r-pr">#></span> 3 E02002353 E02002407 -3.127992 107.6314 -3.127992 107.6314 2</span> <span class="r-out co"><span class="r-pr">#></span> geometry</span> -<span class="r-out co"><span class="r-pr">#></span> 1 LINESTRING (-1.62463 53.886...</span> -<span class="r-out co"><span class="r-pr">#></span> 2 LINESTRING (-1.609934 53.79...</span> -<span class="r-out co"><span class="r-pr">#></span> 3 LINESTRING (-1.609934 53.79...</span> +<span class="r-out co"><span class="r-pr">#></span> 1 LINESTRING (-1.518058 53.84...</span> +<span class="r-out co"><span class="r-pr">#></span> 2 LINESTRING (-1.62463 53.886...</span> +<span class="r-out co"><span class="r-pr">#></span> 3 LINESTRING (-1.518058 53.84...</span> <span class="r-in"><span><span class="fu">sf</span><span class="fu">::</span><span class="fu"><a href="https://r-spatial.github.io/sf/reference/geos_measures.html" class="external-link">st_length</a></span><span class="op">(</span><span class="va">l2</span><span class="op">)</span></span></span> <span class="r-out co"><span class="r-pr">#></span> Units: [m]</span> -<span class="r-out co"><span class="r-pr">#></span> [1] 8192.858 10635.993 8620.398 10635.993 8192.858 8620.398</span> +<span class="r-out co"><span class="r-pr">#></span> [1] 10635.993 8192.858 10635.993 8620.398 8192.858 8620.398</span> <span class="r-in"><span><span class="co"># With max_dist:</span></span></span> -<span class="r-in"><span><span class="op">(</span><span class="va">l3</span> <span class="op">=</span> <span class="fu">points_to_odl</span><span class="op">(</span><span class="va">p</span>, max_dist <span class="op">=</span> <span class="fl">10000</span><span class="op">)</span><span class="op">)</span></span></span> +<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="va"><a href="https://michaeldorman.github.io/nngeo/" class="external-link">nngeo</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span> +<span class="r-in"><span> <span class="op">(</span><span class="va">l3</span> <span class="op">=</span> <span class="fu">points_to_odl</span><span class="op">(</span><span class="va">p</span>, max_dist <span class="op">=</span> <span class="fl">10000</span><span class="op">)</span><span class="op">)</span></span></span> +<span class="r-in"><span> <span class="fu">sf</span><span class="fu">::</span><span class="fu"><a href="https://r-spatial.github.io/sf/reference/geos_measures.html" class="external-link">st_length</a></span><span class="op">(</span><span class="va">l3</span><span class="op">)</span></span></span> +<span class="r-in"><span><span class="op">}</span></span></span> +<span class="r-msg co"><span class="r-pr">#></span> Loading required package: nngeo</span> <span class="r-msg co"><span class="r-pr">#></span> lon-lat points</span> -<span class="r-out co"><span class="r-pr">#></span> Simple feature collection with 7 features and 2 fields</span> -<span class="r-out co"><span class="r-pr">#></span> Geometry type: LINESTRING</span> -<span class="r-out co"><span class="r-pr">#></span> Dimension: XY</span> -<span class="r-out co"><span class="r-pr">#></span> Bounding box: xmin: -1.62463 ymin: 53.79079 xmax: -1.518058 ymax: 53.88605</span> -<span class="r-out co"><span class="r-pr">#></span> Geodetic CRS: WGS 84</span> -<span class="r-out co"><span class="r-pr">#></span> O D geometry</span> -<span class="r-out co"><span class="r-pr">#></span> 1 E02002407 E02002407 LINESTRING (-1.609934 53.79...</span> -<span class="r-out co"><span class="r-pr">#></span> 2 E02002407 E02002353 LINESTRING (-1.609934 53.79...</span> -<span class="r-out co"><span class="r-pr">#></span> 3 E02002336 E02002336 LINESTRING (-1.62463 53.886...</span> -<span class="r-out co"><span class="r-pr">#></span> 4 E02002336 E02002353 LINESTRING (-1.62463 53.886...</span> -<span class="r-out co"><span class="r-pr">#></span> 5 E02002353 E02002353 LINESTRING (-1.518058 53.84...</span> -<span class="r-out co"><span class="r-pr">#></span> 6 E02002353 E02002407 LINESTRING (-1.518058 53.84...</span> -<span class="r-out co"><span class="r-pr">#></span> 7 E02002353 E02002336 LINESTRING (-1.518058 53.84...</span> -<span class="r-in"><span><span class="fu">sf</span><span class="fu">::</span><span class="fu"><a href="https://r-spatial.github.io/sf/reference/geos_measures.html" class="external-link">st_length</a></span><span class="op">(</span><span class="va">l3</span><span class="op">)</span></span></span> <span class="r-out co"><span class="r-pr">#></span> Units: [m]</span> <span class="r-out co"><span class="r-pr">#></span> [1] 0.000 8192.858 0.000 8620.398 0.000 8192.858 8620.398</span> </code></pre></div>