Changes between Version 92 and Version 93 of GeoDjango


Ignore:
Timestamp:
08/04/2007 02:29:45 PM (8 years ago)
Author:
jbronn
Comment:

updated installation info and inserted links to geos docs

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjango

    v92 v93  
    11= !GeoDjango =
    22
    3 [[TOC(GeoDjangoBackground, GeoDjango, GeoDjangoModelAPI, GeoDjangoDatabaseAPI)]]
     3[[TOC(GeoDjangoBackground, GeoDjango, GeoDjangoModelAPI, GeoDjangoDatabaseAPI, GEOSGeometry)]]
    44The [http://code.djangoproject.com/browser/django/branches/gis GIS] branch intends to be a world-class geographic web framework.  Our goal is to make it as easy as possible to build GIS web applications and harness the power of spatially enabled data.
    55
     
    1010 * [wiki:GeoDjangoModelAPI Model API]
    1111 * [wiki:GeoDjangoDatabaseAPI Database API]
     12 * [wiki:GEOSGeometry GEOS Geometries] (in progress).
    1213
    1314== Roadmap ==
     
    5556   * [http://www.mapnik.org/ Mapnik] is modern, but very early on in development and ''completely'' lacks documentation.  However, the code is elegant and clean, and it was designed for integration with Python -- we're leaning towards this right now.
    5657   * [http://mapserver.gis.umn.edu/ Mapserver] has been around for a while, strong backing in the community (e.g. native support in [http://qgis.org/ QGIS]).  Even with documentation, the code looks less inviting than Mapnik (all in C); also has archaic text-based configuration files (pre-dating markup languages).
    57  * GEOS
    58    * '''Update:''' As of r5008, GeoDjango has its own GEOS interface (via {{{ctypes}}})
    59    * GEOS is no longer maintained by Sean Gillies.  ''See'' Sean Gillies, ''[http://zcologia.com/news/150/geometries-for-python/ Geometries for Python]'' (blog post explaining rationale for abandoning GEOS support); ''see also'' Sean's message on the [http://geos.refractions.net/pipermail/geos-devel/2007-March/002851.html GEOS-Devel Mailing List] (Mar. 5, 2007).
    6058 * WMS Server
    6159   * I'm not satisfied with any of the current WMS/WFS implementations.   One implemented in Django would be desirable, e.g., {{{django.contrib.gis.wms}}}.  Thoughts anyone?  (OWSLib looks good, see below)
     
    6866   * Utilities
    6967   * Database representation ideas
    70    * GEOS support, [http://zcologia.com/news/ Sean Gilles] (of PCL) was the maintainer of the old SWIG bindings, and is working on [http://trac.gispython.org/projects/PCL/wiki/ShapeLy ShapeLy], a GeoDjango-inspired GEOS ctypes interface.
     68   * GEOS support, [http://zcologia.com/news/ Sean Gillies] (of PCL) was the maintainer of the old SWIG bindings, and is working on [http://trac.gispython.org/projects/PCL/wiki/ShapeLy ShapeLy], a GeoDjango-inspired GEOS ctypes interface.
    7169 * [http://code.google.com/p/django-coordinatesfield/ CoordinatesField].
    7270   * Jannis Leidel has already come up with a way to manipulate points in the admin interface, BSD licensed.
     
    9492
    9593=== Geographic Models ===
    96 Here is an example of how the model API currently works (assume this example is in geo_app/models.py):
     94Here is an example of how the model API currently works (assume this example is in geoapp/models.py):
    9795{{{
    9896#!python
     
    116114
    117115=== Using syncdb ===
    118 Use the {{{manage.py}}} to invoke {{{syncdb}}} like you normally would:
     116Both {{{manage.py}}} commands {{{sqlall}}} and {{{syncdb}}} work on geographic models:
     117{{{
     118$ python manage.py sqlall geoapp
     119}}}
    119120{{{
    120121#!sql
    121 $ python manage.py sqlall geo_app
    122122BEGIN;
    123 CREATE TABLE "geo_app_school" (
     123CREATE TABLE "geoapp_school" (
    124124    "id" serial NOT NULL PRIMARY KEY,
    125125    "name" varchar(35) NOT NULL
    126 );
    127 CREATE TABLE "geo_app_district" (
     126)
     127;
     128CREATE TABLE "geoapp_district" (
    128129    "id" serial NOT NULL PRIMARY KEY,
    129130    "name" varchar(35) NOT NULL,
    130131    "num" integer NOT NULL
    131 );
    132 SELECT AddGeometryColumn('geo_app_school', 'point', 4326, 'POINT', 2);
    133 CREATE INDEX "geo_app_school_point_id" ON "geo_app_school" USING GIST ( "point" GIST_GEOMETRY_OPS );
    134 SELECT AddGeometryColumn('geo_app_district', 'poly', 4326, 'POLYGON', 2);
    135 CREATE INDEX "geo_app_district_poly_id" ON "geo_app_district" USING GIST ( "poly" GIST_GEOMETRY_OPS );
     132)
     133;
     134SELECT AddGeometryColumn('geoapp_school', 'point', 4326, 'POINT', 2);
     135ALTER TABLE "geoapp_school" ALTER "point" SET NOT NULL;
     136CREATE INDEX "geoapp_school_point_id" ON "geoapp_school" USING GIST ( "point" GIST_GEOMETRY_OPS );
     137SELECT AddGeometryColumn('geoapp_district', 'poly', 4326, 'POLYGON', 2);
     138ALTER TABLE "geoapp_district" ALTER "poly" SET NOT NULL;
     139CREATE INDEX "geoapp_district_poly_id" ON "geoapp_district" USING GIST ( "poly" GIST_GEOMETRY_OPS );
    136140COMMIT;
    137 $ python manage.py syncdb geo_app
    138 
     141}}}
     142{{{
     143$ python manage.py syncdb geoapp
    139144}}}
    140145
     
    146151{{{
    147152#!python
    148 >>> from geo_app.models import District, School
     153>>> from geoapp.models import District, School
    149154>>> qs1 = District.objects.filter(poly__bbcontains='POINT(-95.362293 29.756539)')
    150155>>> qs2 = District.objects.filter(poly__contains='POINT(-95.362293 29.756539)')
     
    161166#!python
    162167>>> qs = District.objects.filter(poly__bbcontains='POINT(-95.362293 29.756539)').filter(poly__contains='POINT(-95.362293 29.756539)')
     168}}}
     169
     170=== Lazy-Geometries ===
     171Geographic fields on models are proxies to [wiki:GEOSGeometry GEOS Geometry] objects, allowing for many interesting possibilities:
     172{{{
     173#!python
     174>>> from django.contrib.gis.geos import fromstr
     175>>> pnt = fromstr('POINT(-95.362293 29.756539)', srid=4326)
     176>>> hisd = District.objects.get(name='Houston ISD')
     177>>> hisd.poly.contains(pnt)
     178True
     179>>> hisd.poly.within(pnt)
     180False
    163181}}}
    164182
     
    171189   * ''Recommended:'' Python 2.5 is recommended because the {{{ctypes}}} module comes included.  [http://www.python.org/download/releases/2.5.1/ Python 2.5.1] is the current latest.
    172190 * '''PostgreSQL'''
    173    * ''Recommended:'' PostgreSQL 8.X
    174    * We are currently using v8.1 of PostgreSQL, and know of no problems with 8.2
     191   * ''Recommended:'' PostgreSQL 8.x.  If installing binary packages, please install the development package as well for headers required in PostGIS compilation.
     192   * We are currently developing using both v8.1 and v8.2 of PostgreSQL.
    175193   * On Ubuntu Feisty, you'll need the apt packages {{{postgresql-server-dev-8.x}}} (the development headers are needed for PostGIS compilation) and {{{postgresql-8.x}}}.
     194 * '''psycopg2'''
     195   * [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.6.tar.gz 2.0.6].
    176196
    177197=== Django ===
     
    183203
    184204=== GEOS ===
    185  * Latest [http://geos.refractions.net/ GEOS] version is 3.0.0RC4
    186  * '''Update:''' As of r5008, you do ''not'' need to enable the Python bindings because GeoDjango has its own GEOS {{{ctypes}}} wrapper.
     205 * We have been developing using [http://geos.refractions.net/ GEOS] 3.0.0RC4, and have not tested or plan on supporting GEOS 2.x.
     206 * GeoDjango has its own GEOS {{{ctypes}}} wrapper; you do ''not'' need to enable the existing GEOS Python bindings.
    187207   * {{{ctypes}}} 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]
    188208 * Configure, make, and install.
     
    194214
    195215=== PROJ.4 ===
    196  * Latest [http://proj.maptools.org/ PROJ.4] version is 4.5.0
     216 * Latest [http://proj.maptools.org/ PROJ.4] version is 4.5.0.  We have no reason to believe that previous versions (''e.g.'', 4.4.x, 4.3.x) will not work.
    197217 * First, download the PROJ [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 source.  For example, if PROJ was unzipped in a directory named {{{proj}}}, then untar these files in {{{proj/nad}}}.  Do this '''before''' you do the configure/make/install dance.
    198218   * ''See'' [http://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].
     
    205225
    206226=== PostGIS ===
    207  * Latest [http://postgis.refractions.net/download/ PostGIS] version is 1.2.1
     227 * '''Required''':  PostGIS v1.1.0 and above.
     228 * '''Recommended''': Postgis v1.2.1 [http://postgis.refractions.net/download/ PostGIS] and greater.
    208229 * First build & install PostGIS.
    209230{{{
     
    231252
    232253=== GDAL ===
    233  * ''Highly Recommended'': Some features (e.g. a large number of {{{SpatialRefSys}}} model routines) require GDAL, but it is not necessary for core functionality (e.g. spatial queries).
     254 * ''Highly Recommended'': Some features (e.g. a large number of {{{SpatialRefSys}}} model routines) require GDAL, but it is not necessary for core functionality (e.g. spatial queries). 
    234255 * GDAL/OGR includes useful for coordinate transformations and reading/writing ''both'' vector (e.g. SHP) and raster (e.g. GeoTIFF) geographic data.
    235256   * For example, the following command will convert your SHP file into [http://en.wikipedia.org/wiki/WGS84 WGS84] (standard lat/lon).  Then you can import directly into your database using {{{shp2pgsql}}} (utility from PostGIS):
Back to Top