~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to docs/ref/contrib/gis/db-api.txt

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
GeoDjango Database API
5
5
======================
6
6
 
 
7
.. _spatial-backends:
 
8
 
 
9
Spatial Backends
 
10
================
 
11
 
 
12
.. module:: django.contrib.gis.db.backends
 
13
   :synopsis: GeoDjango's spatial database backends.
 
14
 
 
15
GeoDjango currently provides the following spatial database backends:
 
16
 
 
17
* ``django.contrib.gis.db.backends.postgis``
 
18
* ``django.contrib.gis.db.backends.mysql``
 
19
* ``django.contrib.gis.db.backends.oracle``
 
20
* ``django.contrib.gis.db.backends.spatialite``
 
21
 
7
22
.. module:: django.contrib.gis.db.models
8
23
   :synopsis: GeoDjango's database API.
9
24
 
10
 
.. _spatial-backends:
11
 
 
12
 
Spatial Backends
13
 
================
14
 
 
15
 
.. versionadded:: 1.2
16
 
 
17
 
In Django 1.2, support for :doc:`multiple databases </topics/db/multi-db>` was
18
 
introduced.  In order to support multiple databases, GeoDjango has segregated
19
 
its functionality into full-fledged spatial database backends:
20
 
 
21
 
* :mod:`django.contrib.gis.db.backends.postgis`
22
 
* :mod:`django.contrib.gis.db.backends.mysql`
23
 
* :mod:`django.contrib.gis.db.backends.oracle`
24
 
* :mod:`django.contrib.gis.db.backends.spatialite`
25
 
 
26
25
.. _mysql-spatial-limitations:
27
26
 
28
27
MySQL Spatial Limitations
76
75
    >>> z = Zipcode(code=78212, poly=poly_3084)
77
76
    >>> z.save()
78
77
    >>> from django.db import connection
79
 
    >>> print connection.queries[-1]['sql'] # printing the last SQL statement executed (requires DEBUG=True)
 
78
    >>> print(connection.queries[-1]['sql']) # printing the last SQL statement executed (requires DEBUG=True)
80
79
    INSERT INTO "geoapp_zipcode" ("code", "poly") VALUES (78212, ST_Transform(ST_GeomFromWKB('\\001 ... ', 3084), 4326))
81
80
 
82
81
Thus, geometry parameters may be passed in using the ``GEOSGeometry`` object, WKT
215
214
    >>> qs = SouthTexasCity.objects.filter(point__distance_gte=(pnt, D(mi=20)))
216
215
    >>> qs = SouthTexasCity.objects.filter(point__distance_gte=(pnt, D(chain=100)))
217
216
 
218
 
__ https://code.djangoproject.com/browser/django/trunk/django/contrib/gis/tests/distapp/models.py
 
217
__ https://github.com/django/django/blob/master/django/contrib/gis/tests/distapp/models.py
219
218
 
220
219
.. _compatibility-table:
221
220
 
286
285
:meth:`GeoQuerySet.extent3d`          X
287
286
:meth:`GeoQuerySet.force_rhr`         X
288
287
:meth:`GeoQuerySet.geohash`           X
289
 
:meth:`GeoQuerySet.geojson`           X
 
288
:meth:`GeoQuerySet.geojson`           X                X
290
289
:meth:`GeoQuerySet.gml`               X        X       X
291
290
:meth:`GeoQuerySet.intersection`      X        X       X
292
291
:meth:`GeoQuerySet.kml`               X                X