项目作者: bcgov

项目描述 :
Map layers for British Columbia, in R for use with the bcmaps package
高级语言: R
项目地址: git://github.com/bcgov/bcmapsdata.git
创建时间: 2017-10-19T19:58:33Z
项目社区:https://github.com/bcgov/bcmapsdata

开源协议:Apache License 2.0

下载


bcmapsdata

Version 0.3.3

img
Travis-CI Build
Status

This is a package that contains many spatial layers for British
Columbia. It is a ‘backend’ data package to provide the layers available
in the bcmaps package. We are
following the strategy recommended by Anderson and
Eddelbuettel
.

Installation

Stable version

  1. install.packages('bcmapsdata', repos='https://bcgov.github.io/drat/')

Development version

  1. # install.packages("remotes")
  2. remotes::install_github("bcgov/bcmapsdata")

Legacy version

Older builds of this package were called bcmaps.rdata and will work
with bcmaps version \<=0.17.1. Those builds can still be installed
using:

  1. install.packages('bcmaps.rdata', repos='https://bcgov.github.io/drat/')

Usage

This package is best used in conjunction with the
bcmaps. Please follow guidance there.

Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an
issue.

How to Contribute

If you would like to contribute to the package, please see our
CONTRIBUTING guidelines.

Please note that this project is released with a Contributor Code of
Conduct
. By participating in this project you agree
to abide by its terms.

Adding a new layer

To add a new layer to the package, there are several steps you need to
follow:

In the data-raw directory:
  1. Create a new folder to hold the data as downloaded from its source.
    It is best if the data is available under an open licence such as
    the Open Government Licence - British
    Columbia

    or the Open Government License -
    Canada
    .
    The data should be zipped up in a .zip file to minimize the size.
    In the directory add a README.md file explaining what the data is
    and where it comes from, a copy of the licence the data is under,
    and a .gitignore file that ignores all files except the zip file,
    the README.md, the licence file, and the .gitignore file.

  2. Create a process_[my_layer].R file in the root of the
    data-raw directory. Use one of the existing files as a
    template. It should source("data-raw/utils.R") and use the
    process_file() function to do the basic processing:

  1. #' Prepare a spatial file for inclusion in bcmapsdata package
  2. #'
  3. #' @param file path to shp or gdb
  4. #' @param transform transform to BC Albers (default `TRUE`)
  5. #' @param repair Repair toplogy (default `TRUE`)
  6. #' @param filter_stmt An optional filter statement - bare, unquoted. E.g., PRUID == 59
  7. #' @param clip_bc Does it require clipping to BC boundary? Default `FALSE`
  8. #'
  9. #' @return processed sf object
  10. process_file(file, layer, transform = TRUE, repair = TRUE, filter_stmt,
  11. clip_bc = FALSE, crs = NULL)

Use devtools::use_data() to save the processed file in the
data directory.

In the R directory:
  1. Create an R file for the documentation of the new layer. Use one of
    the existing R files as a template.
  2. Run devtools::document()

Commit, push and make a pull request

Optionally add a shortcut function to the frontend bcmaps package:

Install your local updated bcmapsdata package with
devtools::install() before moving on to the next steps

In the bcmaps package:
  1. Run devtools::load_all() to load the local version of the package.

  2. Run the internal function bcmaps:::make_shortcuts() while in the
    bcmaps package directory, then run devtools::document(). This will
    automatically generate a shortcut function in bcmaps for your new
    dataset.

  3. Commit your changes and make a pull request to bcmaps.

License

Please note that the data files in the data-raw directory and
subdirectories are licensed separately as they come from different
sources. See the approprate license file in each directory.

The code in this repository is licensed under the Apache License 2.0:

  1. Copyright 2017 Province of British Columbia
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
  7. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  8. See the License for the specific language governing permissions and limitations under the License.