[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eAlloyDB Omni does not inherently include the PostGIS extension, but it can be manually added to an existing installation.\u003c/p\u003e\n"],["\u003cp\u003eAdding PostGIS requires you to have AlloyDB Omni and its CLI already installed on your system.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves identifying your current AlloyDB Omni database server version and setting it as an environment variable.\u003c/p\u003e\n"],["\u003cp\u003eA new AlloyDB Omni container that includes the PostGIS extension must be created using a custom Dockerfile.\u003c/p\u003e\n"],["\u003cp\u003eAfter building the new container, you have to stop the server, modify the dataplane configuration file and then restart the AlloyDB Omni server to make use of the PostGis Extension.\u003c/p\u003e\n"]]],[],null,["# Install PostGIS for AlloyDB Omni\n\nSelect a documentation version: 15.5.2keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/install-postgis)\n- [16.8.0](/alloydb/omni/16.8.0/docs/install-postgis)\n- [16.3.0](/alloydb/omni/16.3.0/docs/install-postgis)\n- [15.12.0](/alloydb/omni/15.12.0/docs/install-postgis)\n- [15.7.1](/alloydb/omni/15.7.1/docs/install-postgis)\n- [15.7.0](/alloydb/omni/15.7.0/docs/install-postgis)\n- [15.5.5](/alloydb/omni/15.5.5/docs/install-postgis)\n- [15.5.4](/alloydb/omni/15.5.4/docs/install-postgis)\n- [15.5.2](/alloydb/omni/15.5.2/docs/install-postgis)\n\n\u003cbr /\u003e\n\nAlloyDB Omni does not include [the PostGIS\nextension](http://www.postgis.net/), but you can manually add it to an existing AlloyDB Omni installation by following the instructions on this page.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\nEnsure that you meet the following system requirements:\n\n- You've [installed AlloyDB Omni](/alloydb/omni/15.5.2/docs/install)\n on your system.\n\n- You've [installed the AlloyDB Omni\n CLI](/alloydb/omni/15.5.2/docs/omni-cli) on your system.\n\nAdd PostGIS to your AlloyDB Omni installation\n---------------------------------------------\n\nTo add the PostGIS extension to your AlloyDB Omni installation,\nfollow these steps:\n\n\u003cbr /\u003e\n\n1. Find your installed AlloyDB Omni version labels: \n\n ```text\n sudo alloydb version\n ```\n\n The output is similar to the following: \n\n ```\n AlloyDB Omni CLI version: 1.0\n AlloyDB Omni database server version: 15.2.0\n ```\n\n Take note of the database server version number; you need it in the next step.\n2. Set the `OMNI_VERSION` environment variable: \n\n ```bash\n OMNI_VERSION=VERSION\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e with the complete database server version\n from the previous step---for example, `15.2.0`.\n3. Create a new AlloyDB Omni container that includes PostGIS:\u003cbr /\u003e\n\n \u003cbr /\u003e\n\n mkdir ~/alloydb-omni-postgis\n\n tee -a ~/alloydb-omni-postgis/Dockerfile \u003c\u003c EOF`\n `ARG OMNI_VERSION`\n `FROM postgres:15-bookworm as postgres\n\n RUN apt-get update && \n\n apt-get install -y --no-install-recommends \n\n postgresql-15-postgis-3 && \n\n apt-get purge -y --auto-remove && \n\n rm -rf /var/lib/apt/lists/*\n\n\n\n FROM gcr.io/alloydb-omni/pg-service:${OMNI_VERSION}\n\n\n\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis-3.so /lib/postgis-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_sfcgal-3.so /lib/postgis_sfcgal-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_raster-3.so /lib/postgis_raster-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/postgis_topology-3.so /lib/postgis_topology-3.so\n COPY --from=postgres /usr/lib/postgresql/15/lib/address_standardizer-3.so /lib/address_standardizer-3.so\n COPY --from=postgres /usr/share/postgresql/15/extension/address_standardizer* /share/extension/\n COPY --from=postgres /usr/share/postgresql/15/extension/postgis* /share/extension/\n\n\n\n COPY --from=postgres /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/\n COPY --from=postgres /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/\n\n\n\n COPY --from=postgres /usr/lib/x86_64-linux-gnu/liblapack.so.3 /usr/lib/\n COPY --from=postgres /usr/lib/x86_64-linux-gnu/libblas.so.3 /usr/lib/\n COPY --from=postgres /usr/lib/libarmadillo.so.11 /usr/lib/\n COPY --from=postgres /usr/lib/libmfhdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libmfhdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libdfalt.so.0 /usr/lib/\n COPY --from=postgres /usr/lib/libogdi.so.4.1 /usr/lib/\n COPY --from=postgres /usr/share/proj/proj.db /usr/share/proj/proj.db\n\n\n EOF\n\n cd ~/alloydb-omni-postgis\n\n sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag gcr.io/alloydb-omni/pg-service-with-postgis:$OMNI_VERSION .\n\n4. Stop the database server: \n\n ```\n sudo alloydb database-server stop\n ```\n5. Open `/var/alloydb/config/dataplane.conf` in a text editor.\n6. Modify the line that defines the `PG_IMAGE` variable so that it refers to the container that you built in a previous step: \n\n ```\n PG_IMAGE=gcr.io/alloydb-omni/pg-service-with-postgis\n ```\n7. Start AlloyDB Omni: \n\n ```\n sudo alloydb database-server start\n ```\n8. Connect to your database: \n\n ```\n sudo docker exec -it pg-service psql -h localhost -U postgres\n ```\n9. Enable PostGIS:\u003cbr /\u003e\n\n \u003cbr /\u003e\n\n ```sql\n CREATE EXTENSION IF NOT EXISTS POSTGIS;\n\n\n\n\n \n \n\n \n \n \n ```"]]