Code

Changes between Version 70 and Version 71 of GeoDjangoInstall


Ignore:
Timestamp:
10/26/08 20:59:56 (6 years ago)
Author:
jbronn
Comment:

Point users to documentation at geodjango.org.

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjangoInstall

    v70 v71  
    3232== Linux & UNIX Platforms == 
    3333 
    34 === Python & PostgreSQL === 
    35  * '''Python''' 
    36    * ''Required:'' Python 2.4 is required because of heavy use of 2.4 decorator syntax (e.g. `@property`).   
    37      * If using Python 2.4, the `ctypes` module needs to be installed as well. 
    38      * Binary packages like `python2.4-ctypes` on Ubuntu/Debian may be used; however, older distributions (like Ubuntu 6.06) use old versions of ctypes that contain bugs -- in such instances, install the latest version (currently 1.0.2) which may be obtained from the [http://sourceforge.net/project/showfiles.php?group_id=71702 ctypes sourceforge project]. 
    39    * ''Recommended:'' Python 2.5 is recommended because the `ctypes` module comes included.  [http://python.org/download/releases/2.5.2/ Python 2.5.2] is the current latest. 
    40  * '''PostgreSQL''' 
    41    * ''Recommended:'' PostgreSQL 8.x.  If installing binary packages, please install the development package as well for headers '''required''' in PostGIS compilation. 
    42    * We are currently developing using both v8.1-8.3 of PostgreSQL. 
    43    * On Ubuntu Feisty and Debian etch, install `postgresql-8.x` and `postgresql-server-dev-8.x` (the development package is '''required''' for PostGIS compilation). 
    44      * On Debian etch install the `libpq-dev` package, which includes the `pg_config` executable (also required for PostGIS compilation). 
    45  * '''psycopg2''' 
    46    * [http://initd.org/tracker/psycopg/wiki/PsycopgTwo psycopg2] is a Python database adapter for PostgreSQL.  Latest version is [http://initd.org/pub/software/psycopg/psycopg2-2.0.7.tar.gz 2.0.7]. 
     34The official documentation for building from source may be found at [http://geodjango.org/docs/install.html geodjango.org]. 
    4735 
    48 === Django === 
    49 !GeoDjango was merged into SVN trunk as of r8219.  Follow Django's [http://www.djangoproject.com/documentation/install/#installing-the-development-version development version installation instructions]. 
     36Documentation suggestions, comments, and tips may be put here. 
    5037 
    5138=== GEOS === 
    52  * ''Required'': GEOS v3.0.0RC4 and above (''not'' compatible with the 2.x versions). 
    53  * ''Recommended'': GEOS [http://download.osgeo.org/geos/geos-3.0.0.tar.bz2 3.0.0] (support for the release candidate versions will be eventually deprecated due to differences in the way geometries are serialized to WKT and HEX, as well as compilation issues for OSX 10.5 -- we urge users to migrate to 3.0.0). 
    5439 
    55 [http://geos.refractions.net GEOS] is an open source C++ library for performing geometric operations, and powers !GeoDjango's "lazy" geometries. 
    56  
    57 !GeoDjango has its own GEOS `ctypes` wrapper; you do ''not'' need to enable the existing GEOS Python bindings. The `ctypes` library comes standard with Python 2.5; if you run Python 2.4, `ctypes` may be [http://sourceforge.net/project/showfiles.php?group_id=71702&package_id=71318 downloaded here], and in Debian etch you may install the `python-ctypes` package. 
    58  
    59 First, download GEOS 3.0.0 from the refractions website and untar the source archive: 
    60 {{{ 
    61 $ wget http://download.osgeo.org/geos/geos-3.0.0.tar.bz2 
    62 $ tar xjf geos-3.0.0.tar.bz2 
    63 }}} 
    64  
    65 Next, change into the directory where GEOS was unpacked, run the `configure` script, compile, and install: 
    66 {{{ 
    67 $ cd geos-3.0.0 
    68 $ ./configure 
    69 $ make 
    70 # make install 
    71 }}} 
    72  
    73 '''Troubleshooting:''' The libgeos is a dependency of both GeoDjango directly and PostGIS. If you get errors like `Could not find the GEOS library (tried "geos_c")` during `syncdb` or when loading the postgis functions into your database (see below), then the library is either not installed or properly linked. 
    74  * You should first make sure that the directory which the GEOS C library was installed in is properly linked. 
    75   * This location is usually `usr/local/lib` on unix systems and can be linked on linux by confirming that `/usr/local/lib` is within `/etc/ld.so.conf` and then running: 
    76 {{{ 
    77 $ ldconfig 
    78 }}} 
    79   * It can also be set as an env variable on Linux by placing `export LD_LIBRARY_PATH=/usr/local/lib` in your bash_profile. 
    80   * It can be set as an env variable on Mac by placing `export DYLD_LIBRARY_PATH=/usr/local/lib` in your bash_profile. 
    81  * As a backup option, the path to the GEOS library may be manually specified by setting `GEOS_LIBRARY_PATH` in your settings.py with the full path to the GEOS library (e.g., `/path/to/libgeos_c.so` for linux or `/path/to/libgeos_c.dylib` file for mac). 
    82  * '''Note''': If the error occured during postgis function insert then restart the PostgreSQL server after making these changes. 
     40The GEOS install instructions has moved to [http://geodjango.org/docs/install.html#id6 geodjango.org]. 
    8341 
    8442=== PROJ.4 === 
    8543 
    86  
    87  * ''Required'': 4.5.0  -- this is not a strict requirement, !GeoDjango has been tested with 4.5.0, but there is no reason to believe that previous versions (e.g., 4.4.x, 4.3.x) will not work. 
    88  * ''Recommended'': [ftp://ftp.remotesensing.org/proj/proj-4.6.0.tar.gz 4.6.0] (the current latest). 
    89  
    90 [http://trac.osgeo.org/proj/ PROJ.4] is a library for converting geospatial data to different coordinate reference systems. 
    91  
    92 First, download PROJ.4 from the remotesensing website, and untar the source archive: 
    93 {{{ 
    94 $ wget http://download.osgeo.org/proj/proj-4.6.0.tar.gz 
    95 $ tar xzf proj-4.6.0.tar.gz 
    96 }}} 
    97  
    98 Next, download the PROJ.4 [ftp://ftp.remotesensing.org/proj/proj-datumgrid-1.3.tar.gz datum shifting files].  These will come in handy for coordinate transformations when other programs (like Mapserver or Mapnik) are not able to cope with EPSG transformations (I learned the hard way). Untar/unzip these in the `nad` subdirectory of the PROJ.4 source: 
    99 {{{ 
    100 $ wget ftp://ftp.remotesensing.org/proj/proj-datumgrid-1.3.tar.gz 
    101 $ cd proj-4.6.0/nad 
    102 $ tar xzf ../../proj-datumgrid-1.3.tar.gz 
    103 }}} 
    104 Do this '''before''' you do the configure/make/install dance. 
    105  * ''See'' [http://www.remotesensing.org/proj/faq.html PROJ FAQ]; ''see also'' [http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0301/msg00541.html Frank Warmerdam's reply to a Mapserver question]. 
    106  
    107 Finally, configure, make and install PROJ.4 within the proj-4.6.0 directory: 
    108 {{{ 
    109 $ cd ../ 
    110 $ ./configure 
    111 $ make 
    112 # make install  
    113 }}} 
     44The PROJ.4 install instructions has moved to [http://geodjango.org/docs/install.html#proj-4 geodjango.org]. 
    11445 
    11546=== PostGIS === 
    116  * ''Required'':  PostGIS v1.2.1 and above. 
    117  * ''Recommended'': [http://postgis.refractions.net PostGIS] [http://postgis.refractions.net/download/postgis-1.3.3.tar.gz v1.3.3] (this is the current [http://postgis.refractions.net/news/20080412/ latest version]). 
    118  * Mac and Windows binaries for PostGIS can also be found on the Refractions research [http://postgis.refractions.net/download/ download site.] 
    11947 
    120 For source install first download PostGIS, and untar the archive: 
    121 {{{ 
    122 $ wget http://postgis.refractions.net/download/postgis-1.3.3.tar.gz 
    123 $ tar xzf postgis-1.3.3.tar.gz 
    124 $ cd postgis-1.3.3 
    125 }}} 
    126  
    127 Run the `configure` script, `make`, and install steps.  
    128 {{{ 
    129 $ ./configure 
    130 $ make 
    131 # make install 
    132 }}} 
    133    * Note: the `flex` package maybe required for PostGIS compilation on Debian distributions and may be installed with the command: `apt-get install flex` 
    134  
    135 Next, create a role and database for your application, and allow it to access PostGIS functionality. 
    136  
    137 Start by switching into the `postgres user`(see below about db initialization if you don't have a postgres user) 
    138 {{{ 
    139 # su - postgres 
    140 }}} 
    141 As the `postgres` user (the user who initialized the database cluster) now do: 
    142 {{{ 
    143 $ createuser <user> 
    144 }}} 
    145  * Note: if you have not initialized the postgres db cluster (if you used apt-get to install postgresql this was already done) do this: 
    146  {{{ 
    147 sudo adduser postgres 
    148 # run through interactive prompt 
    149 sudo su - postgres 
    150 mkdir /path/to/postgres/data 
    151 chmod -R 700 /path/to/postgres/data 
    152 initdb -D /path/to/postgres/data 
    153 pg_ctl start -D /path/to/postgres/data 
    154 }}} 
    155 If you get any errors see http://www.postgresql.org/docs/8.3/interactive/tutorial-createdb.html 
    156  
    157 Now, create the database with your chosen user: 
    158 {{{ 
    159 $ createdb -O <user> <db_name> 
    160 $ createlang plpgsql <db_name> 
    161 }}} 
    162  
    163 Now, load the postgis sql functions and spatial_ref_table of projection information. 
    164  
    165 Note: PostGIS SQL files are ''ususally'' installed in the PostgreSQL share directory (`/usr/postgres/8.2/share` in the example below). Use the `pg_config --sharedir` command to determine this directory on your system, which can vary widely depending on your PostgreSQL version and install method. 
    166  
    167 In addition, depending on your install method for postgis the sql files may be in another location like `/usr/share'. 
    168  
    169 {{{ 
    170 $ psql -d <db_name> -f /usr/postgres/8.2/share/lwpostgis.sql # check your PostgreSQL Version, 8.x 
    171 }}} 
    172 If the lwpostgis.sql file is not found try: 
    173 {{{ 
    174 $ psql -d <db_name> -f /usr/share/lwpostgis.sql # another possible installation location 
    175 }}} 
    176 '''Note:''' ignore any NOTICES, like 'psql:/usr/share/lwpostgis.sql:44: NOTICE:  type "histogram2d" is not yet defined' 
    177  
    178 '''Note:''' errors like `ERROR:  could NOT access file "$libdir/liblwgeom": No such file OR directory` see troubleshooting below 
    179  
    180 {{{ 
    181 $ psql -d <db_name> -f /usr/postgres/8.2/share/spatial_ref_sys.sql 
    182 $ psql <db_name> 
    183 <db_name>=# ALTER TABLE geometry_columns OWNER TO <user>; 
    184 <db_name>=# ALTER TABLE spatial_ref_sys OWNER TO <user>; 
    185 }}} 
    186  
    187  * '''Troubleshooting''': if you experience errors about not finding libraries, you should confirm that libgeos.so (.dylib on mac) has been '''properly installed and linked''' prior to configuring PostGIS. Otherwise you will need to rebuild PostGIS. If it was built and installed properly you may need to adjust your `LD_LIBRARY_PATH`, or DYLD_LIBRARY_PATH (on mac). (This environment can also be configured system-wide on linux by editing `/etc/ld.so.conf` and running `ldconfig`) 
    188   * Hint: Most of the time the libraries you are looking for are in '/usr/local/lib', but geos in particular will output its install location during the `make install` step. 
    189   * Sometimes the errors are too many and not descriptive (i.e. operation aborted), in that cases use the '-s' switch on psql to debug step by step. On Solaris platforms use the `crle` utility to configure the runtime linking environment. 
    190  
    191 Finally, update your `settings.py` to reflect the name and user for the spatially enabled database (thus far, we only plan to support the `psycopg2` backend for PostgreSQL): 
    192 {{{ 
    193 DATABASE_ENGINE='postgresql_psycopg2' 
    194 DATABASE_NAME='<db_name>' 
    195 DATABASE_USER='<user>' 
    196 }}} 
    197  
    198 '''Connection Troubleshooting''': For Django to have proper access to your postgres database you may also need to configure the pg_hba.conf file. Read more about it here: http://www.postgresql.org/docs/8.3/interactive/auth-pg-hba-conf.html 
     48The PostGIS install instructions has moved to [http://geodjango.org/docs/install.html#id9 geodjango.org]. 
    19949 
    20050=== GDAL === 
    201  * ''Required'': GDAL versions 1.4.0 and above (!GeoDjango has not been tested with the 1.3.x series). 
    202  * ''Recommended'': GDAL version 1.5.x and above. 
    20351 
    204 [http://trac.osgeo.org/gdal/ GDAL/OGR] is an excellent open source geospatial library that support features such as coordinate transformations and reading/writing ''both'' vector (e.g., SHP) and raster (e.g., GeoTIFF) geographic data -- however, !GeoDjango does not yet support GDAL's raster capabilities.  Installation of GDAL is ''highly recommended'' because some features (e.g., a large number of `SpatialRefSys` model routines and the `LayerMapping` utility) require GDAL capabilities; however GDAL is not required for core functionality like spatial queries. 
    205    
    206 First, download the latest [http://trac.osgeo.org/gdal/wiki/DownloadSource GDAL] version (currently [http://download.osgeo.org/gdal/gdal-1.5.2.tar.gz 1.5.2]), and untar the archive: 
    207 {{{ 
    208 $ wget http://download.osgeo.org/gdal/gdal-1.5.2.tar.gz 
    209 $ tar xzf gdal-1.5.2.tar.gz 
    210 $ cd gdal-1.5.2 
    211 }}} 
    212  
    213 Configure specifying the data directory (if installing in `/usr/local`, then use `/usr/local/share/gdal`), run `make` (use `gmake` on Solaris platforms) and install: 
    214 {{{ 
    215 $ ./configure --datadir=/usr/local/share/gdal 
    216 $ make 
    217 # make install 
    218 }}} 
    219  * Specifying the data directory at compile time avoids having to set the `GDAL_DATA` environment variable (see [http://trac.osgeo.org/gdal/ticket/2382 GDAL ticket #2382] and the troubleshooting tip below). 
    220  
    221  
    222 === GDAL Troubleshooting === 
    223 '''First try''': 
    224  * Make sure `/usr/local/lib` is in `/etc/ld.so.conf` 
    225  * Run `$ ldconfig` 
    226  * Log out and back into your shell to make sure your settings have taken effect 
    227  
    228 '''Further Troubleshooting''': 
    229 If you receiving the following error message when running the GDAL tests and/or working with `SpatialReference` objects: 
    230 {{{ 
    231 ERROR 4: Unable to open EPSG support file gcs.csv. 
    232 ... 
    233 OGRException: OGR failure. 
    234 }}} 
    235  
    236 The solution is to set the `GDAL_DATA` environment variable to the location of the GDAL data files (typically `/usr/local/share`; use the `gdal-config --datadir` command to find out for sure) before invoking Python. For example: 
    237 {{{ 
    238 $ export GDAL_DATA=`gdal-config --datadir` 
    239 $ python manage.py shell 
    240 }}} 
    241  
    242 You may need to add this environment variable to your Apache configuration file (sites-available/default for example):  
    243 {{{ 
    244 SetEnv GDAL_DATA /usr/local/share 
    245 }}} 
    246  
    247 '''Note:''' The path to the GDAL library may be manually specified by setting `GDAL_LIBRARY_PATH` in your settings with the full path to the GDAL library (e.g., the `.so` or `.dylib` file).   
    248  
    249 Because !GeoDjango uses a native `ctypes` API to access OGR (Vector shape library) and OSR (Spatial reference library) capabilities, there is no need configure the GDAL Python bindings.  If you still want to use the GDAL Python API for your own applications, then use the following configuration flags: 
    250    * `--with-python`: Enables the GDAL Python bindings (all GDAL modules in `osgeo` namespace) 
    251    * `--with-ogpython`: The "old-generation" bindings (separate modules, e.g., `ogr` and `osr`) 
    252    * ''See generally'' [http://trac.osgeo.org/gdal/wiki/GdalOgrInPython GDAL/OGR In Python] on the GDAL trac wiki. 
     52The GDAL installation documentation has moved to [http://geodjango.org/docs/install.html#id11 geodjango.org]. 
    25353 
    25454== Windows ==