diff --git a/django/contrib/gis/db/backends/postgis/creation.py b/django/contrib/gis/db/backends/postgis/creation.py
index bad22be..cc60334 100644
a
|
b
|
class PostGISCreation(DatabaseCreation):
|
38 | 38 | style.SQL_FIELD(qn(f.column)) + |
39 | 39 | style.SQL_KEYWORD(' SET NOT NULL') + ';') |
40 | 40 | |
41 | | |
42 | 41 | if f.spatial_index: |
43 | 42 | # Spatial indexes created the same way for both Geometry and |
44 | 43 | # Geography columns |
45 | | if f.geography: |
| 44 | # PostGIS 2.0 does not support GIST_GEOMETRY_OPS |
| 45 | if f.geography or self.connection.ops.spatial_version >= (2, 0): |
46 | 46 | index_opts = '' |
47 | 47 | else: |
48 | 48 | index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts) |
diff --git a/docs/ref/contrib/gis/install.txt b/docs/ref/contrib/gis/install.txt
index 72bd72a..7d237ee 100644
a
|
b
|
Program Description Required
|
83 | 83 | `PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 4.7, 4.6, 4.5, 4.4 |
84 | 84 | :ref:`GDAL <ref-gdal>` Geospatial Data Abstraction Library No (but, required for SQLite) 1.9, 1.8, 1.7, 1.6, 1.5 |
85 | 85 | :ref:`GeoIP <ref-geoip>` IP-based geolocation library No 1.4 |
86 | | `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 1.5, 1.4, 1.3 |
| 86 | `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.0, 1.5, 1.4, 1.3 |
87 | 87 | `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 3.0, 2.4, 2.3 |
88 | 88 | ======================== ==================================== ================================ ========================== |
89 | 89 | |
… |
… |
installed prior to building PostGIS.
|
239 | 239 | |
240 | 240 | First download the source archive, and extract:: |
241 | 241 | |
242 | | $ wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz |
243 | | $ tar xzf postgis-1.5.2.tar.gz |
244 | | $ cd postgis-1.5.2 |
| 242 | $ wget http://postgis.refractions.net/download/postgis-2.0.1.tar.gz |
| 243 | $ tar xzf postgis-2.0.1.tar.gz |
| 244 | $ cd postgis-2.0.1 |
245 | 245 | |
246 | 246 | Next, configure, make and install PostGIS:: |
247 | 247 | |
… |
… |
Finally, make and install::
|
255 | 255 | |
256 | 256 | .. note:: |
257 | 257 | |
258 | | GeoDjango does not automatically create a spatial database. Please |
259 | | consult the section on :ref:`spatialdb_template` for more information. |
| 258 | If you are running a version of PostgreSQL earlier than 9.1: GeoDjango does |
| 259 | not automatically create a spatial database. Please consult the section on |
| 260 | :ref:`spatialdb_template` for more information. |
260 | 261 | |
261 | 262 | __ http://postgis.refractions.net/ |
262 | 263 | |
… |
… |
to build and install::
|
502 | 503 | Post-installation |
503 | 504 | ================= |
504 | 505 | |
| 506 | Creating a spatial database with PostGIS 2.0 and PostgreSQL 9.1 |
| 507 | ------------------------------------------------ |
| 508 | |
| 509 | PostGIS 2 includes an extension for Postgres 9.1 that can be used to enable |
| 510 | spatial functionality. |
| 511 | |
| 512 | $ createdb <db name> |
| 513 | $ psql <db name> |
| 514 | > CREATE EXTENSION postgis; |
| 515 | > CREATE EXTENSION postgis_topology; |
| 516 | |
505 | 517 | .. _spatialdb_template: |
506 | 518 | |
507 | 519 | Creating a spatial database template for PostGIS |
508 | 520 | ------------------------------------------------ |
509 | 521 | |
| 522 | If you have an earlier version of PostGIS or PostgreSQL, you will need to create |
| 523 | a spatial database. |
| 524 | |
510 | 525 | Creating a spatial database with PostGIS is different than normal because |
511 | 526 | additional SQL must be loaded to enable spatial functionality. Because of |
512 | 527 | the steps in this process, it's better to create a database template that |