{"id":23031996,"url":"https://github.com/uwrit/postgis-docker","last_synced_at":"2025-08-14T15:32:02.268Z","repository":{"id":97970339,"uuid":"231422751","full_name":"uwrit/postgis-docker","owner":"uwrit","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-16T01:22:07.000Z","size":59,"stargazers_count":7,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-17T01:40:24.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/uwrit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-01-02T16:50:50.000Z","updated_at":"2024-02-16T01:22:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"7df6172c-8998-4a4a-8dc1-0e3e6d9401e4","html_url":"https://github.com/uwrit/postgis-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uwrit%2Fpostgis-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uwrit%2Fpostgis-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uwrit%2Fpostgis-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uwrit%2Fpostgis-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uwrit","download_url":"https://codeload.github.com/uwrit/postgis-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229841504,"owners_count":18132565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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"}},"keywords":[],"created_at":"2024-12-15T15:49:19.432Z","updated_at":"2024-12-15T15:49:20.062Z","avatar_url":"https://github.com/uwrit.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postgis-docker\n**postgis-docker** is a Flask REST API for PostGIS TIGER/Line geocoder using Docker containers. This repo:\n\n1) Incorporates steps described in https://experimentalcraft.wordpress.com/2017/11/01/how-to-make-a-postgis-tiger-geocoder-in-less-than-5-days/ for setting up a PostGIS database with TIGER Geocoder, but does so in a pre-configured Docker container for simple setup.\n2) Sets up a simple Python Flask REST API in a second Docker container as a wrapper for the database, binding to port 50000.\n\n## Installation\nSetting up PostGIS and loading [US Census TIGER spatial files](https://www.census.gov/programs-surveys/geography.html) can be a pain, with differing setup configurations for Windows and Unix systems, and the awkward necessity of executing SQL statements in PostGRES which output (somewhat error-prone) shell scripts, which in turn must be executed in a very specific order.\n\n**postgis-docker** simplifies the process.\n\u003e **These steps assume you already have Docker installed on your computer.** If you don't have Docker installed, install [Docker Desktop](https://docs.docker.com/docker-for-windows/install/) if you're on Windows, `brew cask install docker` if on a Mac, or `apt-get`/`yum` if Linux (the setup varies a bit by Linux distro, so search for instructions appropriate for you).\n\n\n1) **clone the repo:**\n```bash\n$ git clone git@github.com:uwrit/postgis-docker.git\n```\n\n2) **Create and configure a `.env` file in the root directory for environment variables:**\n```bash\n$ cd postgis-docker\n$ touch .env\n```\n\nEdit the file to look like this (set the actual values to your needs):\n```bash\nPOSTGRES_DB=geocoder      # Whatever database name you'd like.\nPOSTGRES_USER=\u003cusr\u003e       # Database username.\nPOSTGRES_PASSWORD=\u003cpwd\u003e   # Database password.\nGEOCODER_STATES=WA,OR,CA  # Comma-delimited state abbrevations.\n                          # postgis-docker will load state TIGER files for each state specified here.\n                          # Note: Setting this to \"*\" (without quotes) will load data for all US states.\nGEOCODER_YEAR=2022       # The specific year to download TIGER files for.\n                          # (The Census bureau publishes updated files each year)\n```\n\nNOTE - 2/15/2024 -  Currently postgis only supports ingesting TIGER files from the year 2022 back. SHP2PGSQL currently cannot consume 2023 format TIGER files.\n\n\n3) **Create Docker Overlay Network that is attachable**\n\n```\n$ docker network create --driver overlay --attachable uw_postgis_net\n```\n\n4) **Finally:**\n```bash\n$ docker-compose up\n```\n\nAnd that's it! Note that that TIGER file-load process may take a while, depending on the US states you configure. The logic for dynamically loading and configuring the TIGER files is in [load_data.sh](./src/db/load_data.sh), which is a script adapted from the PostGIS default TIGER setup scripts, but made reusable and dynamic. Doing all states the download and initialization of the container took 10 hours in a recent implementation (you can use docker logs follow to tail the log in real time and track progress).\n\nAfter setup is complete, test it out!\n```bash\n$ # 1410 NE Campus Parkway, Seattle, WA 98195 (the University of Washington)\n$ curl http://localhost:50000/latlong?q=1410+NE+Campus+Parkway%2c+Seattle%2c+WA+98195\n{\n  \"building\": 1410,\n  \"city\": \"Seattle\",\n  \"lat\": 47.6563,\n  \"long\": -122.31314,\n  \"state\": \"WA\",\n  \"street\": \"Campus\",\n  \"streetType\": \"Pkwy\",\n  \"zip\": \"98195\"\n}\n```\n\nThe PostGIS and API containers can be taken down anytime with:\n```bash\n$ docker-compose down\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuwrit%2Fpostgis-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuwrit%2Fpostgis-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuwrit%2Fpostgis-docker/lists"}