Ticket #16455: 16455-v6.diff

File 16455-v6.diff, 3.9 KB (added by Flavio Curella, 12 years ago)
  • django/contrib/gis/db/backends/postgis/creation.py

    diff --git a/django/contrib/gis/db/backends/postgis/creation.py b/django/contrib/gis/db/backends/postgis/creation.py
    index bad22be..f806bc9 100644
    a b class PostGISCreation(DatabaseCreation):  
    3838                                  style.SQL_FIELD(qn(f.column)) +
    3939                                  style.SQL_KEYWORD(' SET NOT NULL') + ';')
    4040
    41 
    4241            if f.spatial_index:
    4342                # Spatial indexes created the same way for both Geometry and
    4443                # Geography columns
    4544                if f.geography:
    4645                    index_opts = ''
     46                # PostGIS 2.0 does not support GIST_GEOMETRY_OPS.
     47                # Use gist_geometry_ops_nd instead.
     48                elif self.connection.ops.spatial_version >= (2, 0):
     49                    index_opts = ' ' + style.SQL_KEYWORD('gist_geometry_ops_nd')
    4750                else:
    4851                    index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts)
    4952                output.append(style.SQL_KEYWORD('CREATE INDEX ') +
  • docs/ref/contrib/gis/install.txt

    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  
    8383`PROJ.4`_                 Cartographic Projections library      Yes (PostgreSQL and SQLite only)  4.7, 4.6, 4.5, 4.4
    8484:ref:`GDAL <ref-gdal>`    Geospatial Data Abstraction Library   No (but, required for SQLite)     1.9, 1.8, 1.7, 1.6, 1.5
    8585: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
    8787`SpatiaLite`__            Spatial extensions for SQLite         Yes (SQLite only)                 3.0, 2.4, 2.3
    8888========================  ====================================  ================================  ==========================
    8989
    installed prior to building PostGIS.  
    239239
    240240First download the source archive, and extract::
    241241
    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
    245245
    246246Next, configure, make and install PostGIS::
    247247
    Finally, make and install::  
    255255
    256256.. note::
    257257
    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.
    260261
    261262__ http://postgis.refractions.net/
    262263
    to build and install::  
    502503Post-installation
    503504=================
    504505
     506Creating a spatial database with PostGIS 2.0 and PostgreSQL 9.1
     507------------------------------------------------
     508
     509PostGIS 2 includes an extension for Postgres 9.1 that can be used to enable
     510spatial functionality.
     511
     512    $ createdb  <db name>
     513    $ psql <db name>
     514    > CREATE EXTENSION postgis;
     515    > CREATE EXTENSION postgis_topology;
     516
    505517.. _spatialdb_template:
    506518
    507519Creating a spatial database template for PostGIS
    508520------------------------------------------------
    509521
     522If you have an earlier version of PostGIS or PostgreSQL, you will need to create
     523a spatial database.
     524
    510525Creating a spatial database with PostGIS is different than normal because
    511526additional SQL must be loaded to enable spatial functionality.  Because of
    512527the steps in this process, it's better to create a database template that
Back to Top