New (experimental) watersheds API

I’ve set up an API for the watersheds app so you can get watersheds even if you’re not using the web app. You just need to provide a carefully formatted URL. There is a separate link for watershed boundaries and for rivers.

The API returns a GeoJSON string that many applications can use. To use it, you need to provide the latitude and longitude of a watershed outlet, and tell it if you want high-precision or low. (Note that if your watershed has an area of over 50,000 kmĀ², the app will automatically revert to low-precision, regardless of what you requested.)

Remember that, just like the regular web app, it can take a while for the app to create large watersheds for the first time. (After they’ve been generated once, the result is cached. Making the same request a second or third time should be fast.)

This feature is experimental and subject to change! Drop me a line and tell me if you are using it for something cool.

Base URLs:

https://mghydro.com/app/watershed_api 
https://mghydro.com/app/upstream_rivers_api

Parameters

To be entered as a query string:

lat: a number from -180 to +180
lng: a number from -60 to +85
precision: "low" or "high", without quotes. Optional: if omitted, defaults to "low"

Examples:

https://mghydro.com/app/watershed_api?lat=43.253&lng=-77.609&precision=high
        
https://mghydro.com/app/upstream_rivers_api?lat=43.253&lng=-77.609&precision=high
    

Usage

With the API, you can plug the URL right into QGIS. Choose Layer > Add Layer > Add Vector Layer, then and in the field, “Vector Dataset(s),” add the URL, then click “Add.” Adjust the styles, and you can have something that looks like this: