Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/03 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/03 (UTC)."],[[["\u003cp\u003eAlloyDB Omni does not come with the PostGIS extension pre-installed, but it can be manually added to enable geospatial data support.\u003c/p\u003e\n"],["\u003cp\u003eTo add PostGIS, you first need to identify the installed AlloyDB Omni version number.\u003c/p\u003e\n"],["\u003cp\u003eA new container including PostGIS will be created by leveraging the previously identified Omni Version.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating the new container, connect to your database and then enable the PostGIS extension.\u003c/p\u003e\n"]]],[],null,["# Install PostGIS for AlloyDB Omni\n\nSelect a documentation version: 15.7.0keyboard_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 to add support for storing, indexing, and querying geospatial data.\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\nEnsure that you've [installed AlloyDB Omni](/alloydb/omni/15.7.0/docs/install) 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 ### Docker\n\n ```docker\n docker run --rm -it google/alloydbomni cat VERSION.txt\n ```\n\n ### Podman\n\n ```text\n podman run --rm -it google/alloydbomni cat VERSION.txt\n ```\n\n The output is similar to the following: \n\n ```\n AlloyDB Omni version: 15.7.0\n ```\n\n Take note of the AlloyDB Omni 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 from the previous step---for example, `15.7.0`.\n3. Create a new AlloyDB Omni container that includes PostGIS: \n\n ### Linux\n\n mkdir ~/alloydb-omni-postgis\n tee -a ~/alloydb-omni-postgis/Dockerfile \u003c\u003c EOF\n ARG OMNI_VERSION\n FROM google/alloydbomni:${OMNI_VERSION}\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 EOF\n cd ~/alloydb-omni-postgis\n sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-postgis:$OMNI_VERSION .\n\n ### macOS\n\n mkdir ~/alloydb-omni-postgis\n tee -a ~/alloydb-omni-postgis/Dockerfile \u003c\u003c EOF\n ARG OMNI_VERSION\n FROM google/alloydbomni:${OMNI_VERSION}\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 EOF\n cd ~/alloydb-omni-postgis\n sudo docker build --build-arg OMNI_VERSION=$OMNI_VERSION --tag google/alloydbomni-with-postgis:$OMNI_VERSION .\n\n4. Create a new container with AlloyDB Omni named `my-omni-postgis`:\n\n ### Docker\n\n ```bash\n docker run --name my-omni-postgis -e POSTGRES_PASSWORD=NEW_PASSWORD -d google/alloydbomni-with-postgis:OMNI_VERSION\n ```\n\n ### Podman\n\n ```\n podman run --name my-omni-postgis -e POSTGRES_PASSWORD=NEW_PASSWORD -d google/alloydbomni-with-postgis:OMNI_VERSION\n ```\n5. Connect to your database with the PostGIS extension:\n\n ```\n docker exec -it my-omni-postgis psql -h localhost -U postgres\n ```\n6. Enable PostGIS:\n\n CREATE EXTENSION IF NOT EXISTS POSTGIS;\n SELECT postgis_full_version();\n\n The output looks similar to the following: \n\n postgres=# SELECT postgis_full_version();\n postgis_full_version\n --------------------------------------------------------------------------------------------------------------------------------\n POSTGIS=\"3.3.2 4975da8\" [EXTENSION] PGSQL=\"150\" GEOS=\"3.11.1-CAPI-1.17.1\" PROJ=\"9.1.1\" LIBXML=\"2.9.14\" LIBJSON=\"0.16\" LIBPROTOBUF=\"1.4.1\" WAGYU=\"0.5.0 (Internal)\"\n (1 row)\n\n\u003cbr /\u003e"]]