top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">opendap.catalog</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">0.0.0.9000</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
  <a href="../articles/index.html">Intro</a>
</li>
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
    Articles
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu">
<li>
      <a href="../articles/dap_utils.html">R Utilites</a>
    </li>
    <li>
      <a href="../articles/catalog.html">OPeDAP catalog</a>
    </li>
    <li>
      <a href="../articles/xyt_aggregation.html">XYT aggregations</a>
    </li>
    <li>
      <a href="../articles/search.html">Catalog Search</a>
    </li>
    <li>
      <a href="../articles/future.html">Going Parallel</a>
    </li>
    <li>
      <a href="../articles/parameter_estimation.html">Parameter Estimation</a>
    </li>
    <li>
      <a href="../articles/usgs_vrts.html">USGS VRTs (next steps)</a>
    </li>
    <li>
      <a href="../articles/lcmap.html">USGS LCMAP</a>
    </li>
  </ul>
</li>
      </ul>
<ul class="nav navbar-nav navbar-right">
<li>
  <a href="https://github.com/mikejohnson51/opendap.catalog/" class="external-link">
    <span class="fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      

      </header><div class="row">
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
      <h1 data-toc-skip>LCMAP Examples</h1>
                        <h4 data-toc-skip class="author"><NAME></h4>
            
            <h4 data-toc-skip class="date">3/8/2022</h4>
      
      <small class="dont-index">Source: <a href="https://github.com/mikejohnson51/opendap.catalog/blob/HEAD/vignettes/lcmap.Rmd" class="external-link"><code>vignettes/lcmap.Rmd</code></a></small>
      <div class="hidden name"><code>lcmap.Rmd</code></div>

    </div>

    
    
<div class="section level2">
<h2 id="general-notes">General Notes<a class="anchor" aria-label="anchor" href="#general-notes"></a>
</h2>
<p>We are looking for efficient, remote-access to LCMAP (and NLCD) data that is not reliant on a service like WCS or REST APIs.</p>
<p>The goal is to be able to access each file at a single non-authenticated end point, and that each file is easily discoverable (either online or via a catalog). The semi-new VSI capabilities in GDAL offer a way to achieve this using the existing LCMAP resources, however they are not stored effiecently for this purpose given they are zipped.</p>
<p>The aim is to show what is possible with what is currently available and - hopefully - provide rationale for a minimally-invasive step towards more efficient data access.</p>
</div>
<div class="section level2">
<h2 id="use-case">Use Case<a class="anchor" aria-label="anchor" href="#use-case"></a>
</h2>
<p>Say we want 2020 land cover data for a county in Colorado (Larimer). We will use this as a respective AOI.</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">AOI</span> <span class="op">&lt;-</span> <span class="fu">AOI</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/AOI/man/aoi_get.html" class="external-link">aoi_get</a></span><span class="op">(</span>state <span class="op">=</span> <span class="st">"CO"</span>, county <span class="op">=</span> <span class="st">"Larimer"</span><span class="op">)</span></code></pre></div>
<p>This county is ~6,825 sqkm with a bounding box area of ~8,700 sqkm. This is approximetly 10,600,000 LCMAP 30 meter cells.</p>
<p><img src="lcmap_files/figure-html/unnamed-chunk-2-1.png" width="700"></p>
</div>
<div class="section level2">
<h2 id="examples">Examples<a class="anchor" aria-label="anchor" href="#examples"></a>
</h2>
<div class="section level4">
<h4 id="vsi-over-zipped-resources">VSI over zipped resources<a class="anchor" aria-label="anchor" href="#vsi-over-zipped-resources"></a>
</h4>
<p>We <em>can</em> backdoor into the existing resources using a fairly complex request that requires knowing the location of the zipped directory and the included file names.</p>
<p>These <em>could</em> be cataloged…</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/base/system.time.html" class="external-link">system.time</a></span><span class="op">(</span><span class="op">{</span>
  <span class="va">r</span> <span class="op">&lt;-</span> <span class="fu">rast</span><span class="op">(</span><span class="st">"/vsizip/{/vsicurl/https://edcintl.cr.usgs.gov/downloads/sciweb1/shared/lcmap/public/full_extent_downloads/version_12/primary-landcover_conus_year_data/LCMAP_CU_2020_V12_LCPRI.zip}/LCMAP_CU_2020_V12_LCPRI.tif"</span><span class="op">)</span>
  <span class="va">r2</span> <span class="op">&lt;-</span> <span class="fu">crop</span><span class="op">(</span><span class="va">r</span>, <span class="fu">project</span><span class="op">(</span><span class="fu">vect</span><span class="op">(</span><span class="va">AOI</span><span class="op">)</span>, <span class="fu">crs</span><span class="op">(</span><span class="va">r</span><span class="op">)</span><span class="op">)</span><span class="