{"id":84778,"name":"fwapg","description":"Extends British Columbia's Freshwater Atlas with PostgreSQL/PostGIS.","url":"https://github.com/smnorris/fwapg","last_synced_at":"2026-04-14T17:00:37.682Z","repository":{"id":39725336,"uuid":"185426100","full_name":"smnorris/fwapg","owner":"smnorris","description":"PostgreSQL tools for working with British Columbia's Freshwater Atlas","archived":false,"fork":false,"pushed_at":"2026-01-16T22:53:25.000Z","size":10013,"stargazers_count":10,"open_issues_count":36,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-06T13:01:42.683Z","etag":null,"topics":["british-columbia","freshwater-atlas","fwa","lakes","linear-referencing","postgis","rivers","streams","watersheds"],"latest_commit_sha":null,"homepage":"https://smnorris.github.io/fwapg","language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smnorris.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-05-07T15:07:42.000Z","updated_at":"2026-01-16T22:53:28.000Z","dependencies_parsed_at":"2024-02-08T01:22:52.240Z","dependency_job_id":"f1eb5dbc-00cc-4bb1-a586-c71bc912150a","html_url":"https://github.com/smnorris/fwapg","commit_stats":{"total_commits":442,"total_committers":2,"mean_commits":221.0,"dds":0.03167420814479638,"last_synced_commit":"9500b61f22fe8d4ae6059bbba3e3e5d97cb9899d"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/smnorris/fwapg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smnorris","download_url":"https://codeload.github.com/smnorris/fwapg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31558386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"owner":{"login":"smnorris","name":"Simon Norris","uuid":"1323293","kind":"user","description":"","email":"","website":"www.hillcrestgeo.ca","location":"British Columbia","twitter":null,"company":"Hillcrest Geographics","icon_url":"https://avatars.githubusercontent.com/u/1323293?v=4","repositories_count":52,"last_synced_at":"2025-10-10T16:35:26.744Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/smnorris","funding_links":[],"total_stars":51,"followers":55,"following":38,"created_at":"2022-11-05T19:12:36.181Z","updated_at":"2025-10-10T16:35:26.744Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smnorris","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smnorris/repositories"},"packages":[{"id":14071150,"name":"github.com/smnorris/fwapg","ecosystem":"go","description":null,"homepage":null,"licenses":null,"normalized_licenses":[],"repository_url":"https://github.com/smnorris/fwapg","keywords_array":[],"namespace":null,"versions_count":18,"first_release_published_at":"2026-03-18T12:27:47.939Z","latest_release_published_at":"2025-11-07T17:53:24.000Z","latest_release_number":"v0.7.1","last_synced_at":"2026-04-12T16:02:59.721Z","created_at":"2026-03-18T12:27:46.079Z","updated_at":"2026-04-12T16:02:59.721Z","registry_url":"https://pkg.go.dev/github.com/smnorris/fwapg","install_command":"go get github.com/smnorris/fwapg","documentation_url":"https://pkg.go.dev/github.com/smnorris/fwapg#section-documentation","metadata":{},"repo_metadata":{},"repo_metadata_updated_at":"2026-03-18T12:44:04.559Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":5.227687248297523,"dependent_packages_count":4.898440373970379,"stargazers_count":null,"forks_count":null,"docker_downloads_count":null,"average":5.063063811133951},"purl":"pkg:golang/github.com/smnorris/fwapg","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/go/github.com/smnorris/fwapg","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/go/github.com/smnorris/fwapg","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/go/github.com/smnorris/fwapg/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":null,"versions_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fsmnorris%2Ffwapg/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fsmnorris%2Ffwapg/version_numbers","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fsmnorris%2Ffwapg/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fsmnorris%2Ffwapg/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fsmnorris%2Ffwapg/codemeta","maintainers":[],"registry":{"name":"proxy.golang.org","url":"https://proxy.golang.org","ecosystem":"go","default":true,"packages_count":2097301,"maintainers_count":0,"namespaces_count":781316,"keywords_count":112803,"github":"golang","metadata":{"funded_packages_count":53476},"icon_url":"https://github.com/golang.png","created_at":"2022-04-04T15:19:22.939Z","updated_at":"2026-04-14T05:14:00.078Z","packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages","maintainers_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/maintainers","namespaces_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/namespaces"}}],"commits":{"id":1382546,"full_name":"smnorris/fwapg","default_branch":"main","total_commits":478,"total_committers":2,"total_bot_commits":0,"total_bot_committers":0,"mean_commits":239.0,"dds":0.029288702928870314,"past_year_total_commits":26,"past_year_total_committers":1,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":26.0,"past_year_dds":0.0,"last_synced_at":"2026-04-12T16:03:01.734Z","last_synced_commit":"892a90b1ca053b75ff3b4cddcb2656490cbbd215","created_at":"2023-09-21T13:10:12.452Z","updated_at":"2026-04-12T16:03:01.229Z","committers":[{"name":"Simon Norris","email":"snorris@hillcrestgeo.ca","login":"smnorris","count":464},{"name":"franTarkenton","email":"kevin.netherton@gov.bc.ca","login":"franTarkenton","count":14}],"past_year_committers":[{"name":"Simon Norris","email":"snorris@hillcrestgeo.ca","login":"smnorris","count":26}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-14T00:00:07.982Z","repositories_count":6213322,"commits_count":903403347,"contributors_count":34927206,"owners_count":1144335,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"smnorris/fwapg","html_url":"https://github.com/smnorris/fwapg","last_synced_at":"2026-04-08T14:00:23.328Z","status":"active","issues_count":116,"pull_requests_count":31,"avg_time_to_close_issue":5214409.641975309,"avg_time_to_close_pull_request":224070.4,"issues_closed_count":81,"pull_requests_closed_count":30,"pull_request_authors_count":2,"issue_authors_count":6,"avg_comments_per_issue":1.1293103448275863,"avg_comments_per_pull_request":0.03225806451612903,"merged_pull_requests_count":27,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":11,"past_year_pull_requests_count":8,"past_year_avg_time_to_close_issue":1366049.8333333333,"past_year_avg_time_to_close_pull_request":33487.0,"past_year_issues_closed_count":6,"past_year_pull_requests_closed_count":7,"past_year_pull_request_authors_count":1,"past_year_issue_authors_count":2,"past_year_avg_comments_per_issue":1.2727272727272727,"past_year_avg_comments_per_pull_request":0.125,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":7,"created_at":"2023-09-21T13:10:42.593Z","updated_at":"2026-04-08T14:00:23.328Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnorris%2Ffwapg/issues","issue_labels_count":{"bug":24,"enhancement":9,"data":2,"advertising":1},"pull_request_labels_count":{},"issue_author_associations_count":{"OWNER":108,"NONE":7,"COLLABORATOR":1},"pull_request_author_associations_count":{"OWNER":30,"CONTRIBUTOR":1},"issue_authors":{"smnorris":108,"joethorley":3,"NewGraphEnvironment":2,"paddleman":1,"daimoriwaki":1,"heckstra":1},"pull_request_authors":{"smnorris":30,"franTarkenton":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-14T00:00:07.923Z","repositories_count":14259628,"issues_count":34609914,"pull_requests_count":113169222,"authors_count":11234438,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{"OWNER":10,"NONE":1},"past_year_pull_request_author_associations_count":{"OWNER":8},"past_year_issue_authors":{"smnorris":10,"NewGraphEnvironment":1},"past_year_pull_request_authors":{"smnorris":8},"maintainers":[{"login":"smnorris","count":138,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/smnorris"},{"login":"daimoriwaki","count":1,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/daimoriwaki"}],"active_maintainers":[{"login":"smnorris","count":18,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/smnorris"}]},"events":{"total":{"DeleteEvent":6,"PullRequestEvent":10,"IssuesEvent":17,"IssueCommentEvent":17,"PushEvent":78,"CreateEvent":11},"last_year":{"DeleteEvent":2,"PullRequestEvent":4,"IssuesEvent":10,"IssueCommentEvent":11,"PushEvent":51,"CreateEvent":5}},"keywords":["british-columbia","freshwater-atlas","fwa","lakes","linear-referencing","postgis","rivers","streams","watersheds"],"dependencies":[{"ecosystem":"pypi","filepath":"docs/requirements.txt","sha":null,"kind":"manifest","created_at":"2022-08-25T14:41:54.328Z","updated_at":"2022-08-25T14:41:54.328Z","repository_link":"https://github.com/smnorris/fwapg/blob/main/docs/requirements.txt","dependencies":[{"id":2696582331,"package_name":"myst_parser","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false},{"id":2696582332,"package_name":"sphinx_rtd_theme","ecosystem":"pypi","requirements":"*","direct":true,"kind":"runtime","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/build-docker-image.yml","sha":null,"kind":"manifest","created_at":"2024-02-01T06:44:02.404Z","updated_at":"2024-02-01T06:44:02.404Z","repository_link":"https://github.com/smnorris/fwapg/blob/main/.github/workflows/build-docker-image.yml","dependencies":[{"id":15958285314,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":15958285315,"package_name":"docker/login-action","ecosystem":"actions","requirements":"65b78e6e13532edd9afa3aa52ac7964289d1a9c1","direct":true,"kind":"composite","optional":false},{"id":15958285316,"package_name":"docker/metadata-action","ecosystem":"actions","requirements":"9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7","direct":true,"kind":"composite","optional":false},{"id":15958285317,"package_name":"docker/build-push-action","ecosystem":"actions","requirements":"f2a1d5e99d037542a71f64918e516c093c6f3fc4","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/build-docs.yml","sha":null,"kind":"manifest","created_at":"2024-02-01T06:44:02.447Z","updated_at":"2024-02-01T06:44:02.447Z","repository_link":"https://github.com/smnorris/fwapg/blob/main/.github/workflows/build-docs.yml","dependencies":[{"id":15958286322,"package_name":"actions/checkout","ecosystem":"actions","requirements":"master","direct":true,"kind":"composite","optional":false},{"id":15958286323,"package_name":"erpcya/sphinx-action","ecosystem":"actions","requirements":"feature/#update-sphinx-base-image","direct":true,"kind":"composite","optional":false},{"id":15958286703,"package_name":"ad-m/github-push-action","ecosystem":"actions","requirements":"master","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"docker","filepath":"Dockerfile","sha":null,"kind":"manifest","created_at":"2024-02-01T06:44:02.786Z","updated_at":"2024-02-01T06:44:02.786Z","repository_link":"https://github.com/smnorris/fwapg/blob/main/Dockerfile","dependencies":[{"id":15958286704,"package_name":"ghcr.io/osgeo/gdal","ecosystem":"docker","requirements":"ubuntu-small-3.8.0","direct":true,"kind":"build","optional":false}]},{"ecosystem":"docker","filepath":"docker-compose.yml","sha":null,"kind":"manifest","created_at":"2024-02-01T06:44:02.953Z","updated_at":"2024-02-01T06:44:02.953Z","repository_link":"https://github.com/smnorris/fwapg/blob/main/docker-compose.yml","dependencies":[{"id":15958286794,"package_name":"postgis/postgis","ecosystem":"docker","requirements":"16-3.4","direct":true,"kind":"runtime","optional":false},{"id":15958286795,"package_name":"pramsey/pg_featureserv","ecosystem":"docker","requirements":"latest","direct":true,"kind":"runtime","optional":false},{"id":15958286796,"package_name":"pramsey/pg_tileserv","ecosystem":"docker","requirements":"latest","direct":true,"kind":"runtime","optional":false}]}],"score":null,"created_at":"2023-09-21T12:55:56.896Z","updated_at":"2026-04-14T17:00:37.684Z","avatar_url":"https://github.com/smnorris.png","language":"PLpgSQL","category":"Hydrosphere","sub_category":"Freshwater and Hydrology","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"# fwapg\n\n`fwapg` extends British Columbia's [Freshwater Atlas](https://www2.gov.bc.ca/gov/content/data/geographic-data-services/topographic-data/freshwater) (FWA) with PostgreSQL/PostGIS. `fwapg` provides additional tables, indexes and functions to:\n\n- quickly translate arbitrary point locations (`X,Y`) to a linear reference positions (`blue_line_key, measure`) on the stream network\n- enable speedy upstream/downstream queries throughout BC\n- quickly and cleanly generate watershed boundaries upstream of arbitrary locations\n- enable cross-boundary queries by combining FWA data with data from neighbouring jurisdictions\n- enable querying of FWA features via spatial SQL\n- provide `gradient` values for every FWA stream\n- enable quickly serving FWA features as vector tiles (MVT)\n- enable quickly serving FWA features and custom fwapg functions\n- link additional data to FWA streams (PCIC mean annual discharge, modelled channel width, upstream precipitation)\n\nSee [documentation](https://smnorris.github.io/fwapg/) for setup and usage details, plus table and function references.\n\n\n## Quickstart\n\n1. Ensure all requirements/dependencies are met/installed. \n    - access to a PostgreSQL (\u003e13) database with the PostGIS extension\n    - GDAL \u003e=3.6\n    - Python 3\n    - [`bcdata`](https://github.com/smnorris/bcdata)\n\nSee the Dockerfile for the full list of dependencies.\n    \n\n2. Ensure you have a `DATABASE_URL` environment variable set to point to your database, for example:\n\n        export DATABASE_URL=postgresql://username:password@localhost:5432/fwapg\n\n3. Get scripts, load and optimize the data:\n\n        git clone https://github.com/smnorris/fwapg.git\n        cd fwapg\n        cd db \u0026\u0026 ./create.sh \u0026\u0026 cd ..    # load extensions, create schemas/tables\n        ./load.sh                        # load the data\n\nThe full load takes some time - but once complete, you can run `fwapg` enabled queries with your favorite sql client. For example:\n\n*Locate the nearest point on the FWA stream network to a X,Y location on Highway 14:*\n\n        SELECT \n          gnis_name, \n          blue_line_key, \n          downstream_route_measure\n        FROM FWA_IndexPoint(ST_Transform(ST_GeomFromText('POINT(-123.7028 48.3858)', 4326), 3005));\n\n          gnis_name  | blue_line_key | downstream_route_measure\n        -------------+---------------+--------------------------\n         Sooke River |     354153927 |        350.2530543284006\n\n*Generate the watershed upstream of this location:*\n\n        SELECT ST_ASText(geom) FROM FWA_WatershedAtMeasure(354153927, 350);\n\n         st_astext\n        --------------\n        POLYGON((...\n\n*Select all stream upstream of this location:*\n\n        SELECT ST_ASText(geom)\n        FROM FWA_UpstreamTrace(354153927, 350);\n\n         st_astext\n        --------------\n        LINESTRINGZM((...\n\n\nSee [Usage](https://smnorris.github.io/fwapg/01_usage.html) for more examples.\n\n\n## Tile and feature services\n\n`fwapg` features and functions are served from hillcrestgeo.ca as GeoJSON or vector tiles via these web services and wrappers:\n\n- [features.hillcrestgeo.ca/fwa](https://features.hillcrestgeo.ca/fwa): tables and functions served as GeoJSON\n- [fwapgr (R)](https://github.com/poissonconsulting/fwapgr): an R wrapper around the `features.hillcrestgeo.ca/fwa` feature service\n- [fwatlasbc (R)](https://github.com/poissonconsulting/fwatlasbc): an R package for higher level queries\n- [tiles.hillcrestgeo.ca/bcfishpass](https://tiles.hillcrestgeo.ca/bcfishpass): FWA features (and others) served as vector tiles (MVT)\n\n\n## Source data\n\n- BC Freshwater Atlas [documentation](https://www2.gov.bc.ca/gov/content/data/geographic-data-services/topographic-data/freshwater) and [license](https://www2.gov.bc.ca/gov/content/data/open-data/open-government-licence-bc)\n\n- BC stream contributing areas (watershed boundaries) outside of BC were provided by Dan Weller, DFO \n\n## Development and testing\n\nExtremely basic tests are included for selected functions.\nIf changing a covered function, run the individual test. For example:\n\n    psql -f tests/test_fwa_upstream.sql\n\nAll results should be true.\n\n## Documentation\n\nDocumentation is built from the markdown files in `/docs`.\nInfo in the table reference page (`02_tables_views.md`) can be autogenerated from comments in the database. To dump the text to stdout:\n```\ncd docs\n./table_reference.sh \n```","funding_links":[],"readme_doi_urls":[],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":[],"project_url":"https://ost.ecosyste.ms/api/v1/projects/84778","html_url":"https://ost.ecosyste.ms/projects/84778"}