Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 2 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
[![Actions Status](https://github.com/smnorris/bcdata/actions/workflows/tests.yml/badge.svg)](https://github.com/smnorris/bcdata/actions?query=workflow%3Atests)
[![pypi](https://img.shields.io/pypi/v/bcdata.svg)](https://pypi.python.org/pypi/bcdata/)

Python and command line tools for quick access to DataBC geo-data available via WFS/WCS.
Python and command line tools for quick access to DataBC geo-data available via WFS.

There is a [wealth of British Columbia geographic information available as open
data](https://catalogue.data.gov.bc.ca/dataset?download_audience=Public),
but most sources are available only via WFS - and the syntax to download WFS data via `ogr2ogr` and/or `curl/wget` can be awkward.

This tool attempts to simplify downloads of BC geographic data and smoothly integrate with PostGIS and Python GIS tools like `geopandas`, `fiona` and `rasterio`. The tool only accesses geographic data [avialable via WFS/WCS](https://bcgov.github.io/data-publication/pages/tips_tricks_webservices.html) - for other BC open data, download the files directly with `requests` / `curl` / `ogr2ogr` / etc (or the [bcdata R package](https://github.com/bcgov/bcdata)).
This tool attempts to simplify downloads of BC geographic data and smoothly integrate with PostGIS and Python GIS tools like `geopandas`, `fiona` and `rasterio`. The tool only accesses geographic data [avialable via WFS](https://bcgov.github.io/data-publication/pages/tips_tricks_webservices.html) - for other BC open data, download the files directly with `requests` / `curl` / `ogr2ogr` / etc (or the [bcdata R package](https://github.com/bcgov/bcdata)).

If downloads are failing, consult the [BCGov Data Systems and Services uptime monitor](https://uptime.com/statuspage/bcgov-dss) - this tool depends on BC Open Geospatial Web Services API at [openmaps.gov.bc.ca](https://openmaps.gov.bc.ca/geo/pub/ows?service=WFS&request=Getcapabilities) and the [BC Data Catalogue API](https://catalogue.data.gov.bc.ca/dataset/bc-data-catalogue-api).

Expand Down Expand Up @@ -98,7 +98,6 @@ Options:
Commands:
bc2pg Load a DataBC WFS layer to a postgres db
cat Write DataBC features to stdout as GeoJSON feature objects.
dem Dump BC DEM to TIFF
dump Write DataBC features to stdout as GeoJSON feature collection.
info Print basic metadata about a DataBC WFS layer as JSON.
list List DataBC layers available via WFS
Expand Down Expand Up @@ -166,29 +165,6 @@ Options:
--help Show this message and exit.
```

#### dem

```
$ bcdata dem --help

Usage: bcdata dem [OPTIONS]

Dump BC DEM to TIFF

Options:
-o, --out_file TEXT Output file
--bounds TEXT Bounds: "left bottom right top" or "[left,
bottom, right, top]". Coordinates are BC
Albers (default) or --bounds_crs [required]
--bounds-crs TEXT CRS of provided bounds
-r, --resolution INTEGER
-a, --align Align provided bounds to provincial standard
-i, --interpolation [nearest|bilinear|bicubic]
-v, --verbose Increase verbosity.
-q, --quiet Decrease verbosity.
--help Show this message and exit.
```

#### dump

```
Expand Down
6 changes: 0 additions & 6 deletions scripts/document_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ printf '```\n$ bcdata cat --help\n\n' >> cli.md
bcdata cat --help >> cli.md
printf '```\n' >> cli.md

printf '\n' >> cli.md
printf '#### dem \n\n' >> cli.md
printf '```\n$ bcdata dem --help\n\n' >> cli.md
bcdata dem --help >> cli.md
printf '```\n' >> cli.md

printf '\n' >> cli.md
printf '#### dump \n\n' >> cli.md
printf '```\n$ bcdata dump --help\n\n' >> cli.md
Expand Down
1 change: 0 additions & 1 deletion src/bcdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from .bc2pg import bc2pg as bc2pg
from .bcdc import get_table_definition as get_table_definition
from .bcdc import get_table_name as get_table_name
from .wcs import get_dem as get_dem
from .wfs import get_count as get_count
from .wfs import get_data as get_data
from .wfs import get_sortkey as get_sortkey
Expand Down
53 changes: 0 additions & 53 deletions src/bcdata/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ def bounds_handler(ctx, param, value):
help='Bounds: "left bottom right top" or "[left, bottom, right, top]". Coordinates are BC Albers (default) or --bounds_crs',
)

bounds_opt_dem = click.option(
"--bounds",
required=True,
default=None,
callback=bounds_handler,
help='Bounds: "left bottom right top" or "[left, bottom, right, top]". Coordinates are BC Albers (default) or --bounds_crs',
)


lowercase_opt = click.option(
"--lowercase", "-l", is_flag=True, help="Write column/properties names as lowercase"
Expand Down Expand Up @@ -137,51 +129,6 @@ def info(dataset, indent, meta_member, verbose, quiet):
click.echo(json.dumps(info, indent=indent))


@cli.command()
@click.option("--out_file", "-o", help="Output file", default="dem25.tif")
@bounds_opt_dem
@click.option(
"--bounds-crs",
help="CRS of provided bounds",
default="EPSG:3005",
)
@click.option("--resolution", "-r", type=int, default=25)
@click.option(
"--align",
"-a",
is_flag=True,
help="Align provided bounds to provincial standard",
)
@click.option(
"--interpolation",
"-i",
type=click.Choice(["nearest", "bilinear", "bicubic"], case_sensitive=False),
)
@verbose_opt
@quiet_opt
def dem(
bounds,
bounds_crs,
align,
out_file,
resolution,
interpolation,
verbose,
quiet,
):
"""Dump BC DEM to TIFF"""
verbosity = verbose - quiet
configure_logging(verbosity)
bcdata.get_dem(
bounds,
out_file=out_file,
align=align,
src_crs=bounds_crs,
resolution=resolution,
interpolation=interpolation,
)


@cli.command()
@click.argument("dataset", type=click.STRING)
@click.option(
Expand Down
130 changes: 0 additions & 130 deletions src/bcdata/wcs.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/test_bcdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def test_get_table_definition_format_multi_nopreview():

def test_get_table_definition_format_multi_nolayer():
table_definition = bcdc.get_table_definition(
"WHSE_HUMAN_CULTURAL_ECONOMIC.HIST_HISTORIC_ENVIRONMENTS_SP"
"WHSE_HUMAN_CULTURAL_ECONOMIC.HIST_HISTORIC_ENVIRONMNT_PA_SV"
)
assert table_definition["description"]
assert table_definition["comments"]
# assert table_definition["comments"] there are no comments associated with this dataset
assert table_definition["schema"]


Expand Down
67 changes: 0 additions & 67 deletions tests/test_wcs.py

This file was deleted.