Skip to content
Rapid Watershed Delineation Code for MMW2
Branch: develop
Clone or download
Pull request Compare This branch is 103 commits ahead of nazmussazib:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.travis
R
rwd_drb
rwd_nhd
scripts
src/api
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
DESCRIPTION.rst
Dockerfile
LICENSE
MANIFEST.in
README.md
RWD_pre_requisite_Updated.sh
docker-compose.yml
requirements.txt
setup.cfg
setup.py

README.md

rapid-watershed-delineation

A docker image and fork of @nazmussazib's Rapid Watershed Delineation project, for use in Model My Watershed.

Travis CI Docker Repository on Quay.io Apache V2 License

Getting started

  • Define environment variables (see below)
  • Run ./scripts/update.sh
  • Run ./scripts/server.sh

Linux & Docker for Mac on macOS

  • Run curl http://localhost:5000/rwd/39.892986/-75.276639

Docker Machine on macOS

  • Find the IP of the default VM using docker-machine ip default
  • Run curl http://<default_vm_ip>:5000/rwd/39.892986/-75.276639

Environment Variables

Name Description Example
RWD_DATA Path to RWD data /media/passport/rwd-nhd

RWD Data

Folder structure:

> tree -L 2 /media/passport/rwd-nhd/
|-- drb
|   |-- Main_Watershed
|   `-- Subwatershed_ALL
`-- nhd
    |-- Main_Watershed
    |-- Subwatershed_ALL

Running inside Model My Watershed

To run RWD inside the MMW application during development, follow these instructions.

In the MMW project:

# Change the rwd_host setting to 10.0.2.2
vim deployment/ansible/roles/model-my-watershed.rwd/defaults/main.yml
vagrant reload worker --provision

Note that 10.0.2.2 should point to your host. Verify this by running route -n inside the worker VM. It should be the default gateway. For Mac OS X, this IP should be the result of docker-machine ip.

Then in this project, run:

./scripts/server.sh

Deployments

To create a new release, use the following git commands:

$ git flow release start 0.1.0
$ vim CHANGELOG.md
$ vim setup.py
$ vim src/api/main.py
$ git add CHANGELOG.md setup.py src/api/main.py
$ git commit -m "0.1.0"
$ git flow release publish 0.1.0
$ git flow release finish 0.1.0
$ git push --tags

Afterward, push your develop and master branches to remote using:

$ git push origin develop:develop
$ git push origin master:master

RWD API

Request

Name Method Description
/rwd/lat/lng GET Run RWD for DRB for client-supplied <lat> & <lng> coordinates.
/rwd-nhd/lat/lng GET Run RWD for NHD for client-supplied <lat> & <lng> coordinates.

Parameters

Name Type Required/Optional Description
simplify number optional Simplify tolerance for response GeoJSON. Request unsimplified shape with simplify=0. Defaults to 0.0001 for DRB and is derived from the shape's area for NHD when not supplied.
maximum_snap_distance number optional Maximum distance to snap input point. Defaults to 10000 when not supplied.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.