Changes between Version 42 and Version 43 of GeoDjango


Ignore:
Timestamp:
Mar 25, 2007, 2:19:40 PM (18 years ago)
Author:
jbronn
Comment:

added database api and table of contents

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjango

    v42 v43  
    1 The [http://code.djangoproject.com/browser/django/branches/gis gis] branch intends to add a contrib app implementing geographic support.
    2 
    3 = What's GIS? =
     1The [http://code.djangoproject.com/browser/django/branches/gis gis] branch intends to add a contrib app allowing for Geographic-enabled fields and queries.
     2
     3'''Table of Contents'''
     4 * [GeoDjango#Background Background]
     5 * [GeoDjango#FAQ FAQ]
     6 * [GeoDjango#Implementation Implementation]
     7 * [GeoDjango#Example Example]
     8 * [GeoDjango#Installation Installation]
     9 * [GeoDjango#ModelAPI Model API]
     10 * [GeoDjango#DatabaseAPI Database API]
     11
     12= Background =
     13'''Note:''' The content herein is a loosely structured collection of notes and links that we have found useful, not necessarily what will be supported in the future.
     14
     15== What's GIS? ==
    416 * [http://cfis.savagexi.com/articles/category/gis Series of blog posts] giving intro to GIS; choice quote from [http://cfis.savagexi.com/articles/2006/04/20/on-coordinate-systems#comments an early post]: "If you feel like ending a conversation with a developer then simply bring up the topic of character encodings ... [o]r ... coordinate systems. ... So in the spirit of Tim Bray's and Joel Spolsky's wonderful writeups of character encodings, I thought I'd put together a basic survival guide to coordinate systems over my next few posts and then tie it back to Google Maps."
    517 * More on [http://en.wikipedia.org/wiki/Map_projection map projections], including why people can't agree on just one (utf-8).
    618 * [http://en.wikipedia.org/wiki/Geodesy geodesy] the field of science for this stuff.
    719
    8 = Useful code =
     20== Useful code ==
    921 * [http://postgis.refractions.net/ PostGIS], the [http://www.opengis.org/docs/99-049.pdf OpenGIS SQL Types (pdf)] implementation for Postgresql
    1022 * [http://geos.refractions.net/ GEOS], low-level C++ port of [http://www.jump-project.org/project.php?PID=JTS Jave Topology Suite], used by PostGIS
     
    2840   * [http://cartographer.rubyforge.org/ Cartographer] GMaps plugin
    2941
    30 = Useful Data =
     42== Useful Data ==
    3143 * [http://www.census.gov/geo/www/tiger/tiger2006fe/tgr2006fe.html TIGER/Line]: "The TIGER/Line files are extracts of selected geographic and cartographic information from the [http://www.census.gov/ Census Bureau's] TIGER®  (Topologically Integrated Geographic Encoding and Referencing) database."  This data is useful in creating your own geocoding database service.  Currently 2006 First Edition is the latest, but second edition should be coming soon.  Note: The Census Bureau will be [http://www.census.gov/geo/www/tiger/tgrshp.html providing SHP files] in Fall, 2007. 
    3244
    33 = Questions =
    34  * When dealing with points (say, degrees) from, do they need to be converted to be useful on the back-end data, assuming -that- data is in degrees?  Is it enough to have the same datum and origin?  (Reading the intro above is likely to answer the question.)
     45= FAQ =
     46 * Place your questions '''here'''.
     47 * '''Q:'''When dealing with points (say, degrees) from, do they need to be converted to be useful on the back-end data, assuming -that- data is in degrees?  Is it enough to have the same datum and origin?  (Reading the intro above is likely to answer the question.)
    3548   * My (JDunck) reading indicates yes.  Given the same coordinate system (i.e. datum, origin, and axes), degrees are useful without conversion.
    3649
     
    199212
    200213== Creating a Geometry Object and Saving ==
    201 Here is an example of how to create a geometry object (assuming the {{{Zip}}} model example above).  Geometries can be represented in either the WKT (Well Known Text) format, or in HEXEWKB (PostGIS specific, essentially a WKB geometry in hexadecimal).   ''See'' Open GIS Consortium, Inc., ''[http://portal.opengeospatial.org/files/?artifact_id=829&ei=Z5oGRv6aCZ-IwQKh2LXwAw&usg=__4YgoHsbqjocl8Z01SwMAyN84aW0=&sig2=4DpSpm83ZDEIBKSivWcYGQ OpenGIS Simple Feature Specification For SQL]'', Document 99-049 (May 5, 1999), at  Ch. 3.2.5 (SQL Textual Representation of Geometry, pg. 53); ''see also'' [http://postgis.refractions.net/docs/ch04.html#id2904792 "PostGIS EWKB, EWKT and Canonical Forms"], PostGIS documentation at Ch. 4.1.2].
     214Here is an example of how to create a geometry object (assuming the {{{Zip}}} model example above).  Geometries can be represented in either the WKT (Well Known Text) format, or in HEXEWKB (PostGIS specific, essentially a WKB geometry in hexadecimal).   ''See'' Open GIS Consortium, Inc., ''[http://portal.opengeospatial.org/files/?artifact_id=829&ei=Z5oGRv6aCZ-IwQKh2LXwAw&usg=__4YgoHsbqjocl8Z01SwMAyN84aW0=&sig2=4DpSpm83ZDEIBKSivWcYGQ OpenGIS Simple Feature Specification For SQL]'', Document 99-049 (May 5, 1999), at  Ch. 3.2.5 (SQL Textual Representation of Geometry, pg. 53); ''see also'' [http://postgis.refractions.net/docs/ch04.html#id2904792 "PostGIS EWKB, EWKT and Canonical Forms"], PostGIS documentation at Ch. 4.1.2.
    202215{{{
    203216>>> from zipcode.models import Zip
     
    205218>>> z.save()
    206219}}}
     220
     221= Database API =
     222
     223== PostGIS Operator Field Lookup Types ==
     224
     225 * ''See generally'', [http://postgis.refractions.net/docs/ch06.html#id2618041 "Operators", PostGIS Documentation at Ch. 6.2.2]
     226 * '''Note:'''  This API is subject to some change, ''i.e.'', {{{overlapsbelow}}} is expected to become {{{overlaps_below}}}.
     227 * {{{overlapsleft}}}
     228   * Returns true if A's bounding box overlaps or is to the left of B's bounding box.
     229   * PostGIS equivalent "{{{&<}}}"
     230 * {{{overlapsright}}}
     231   * Returns true if A's bounding box overlaps or is to the right of B's bounding box.
     232   * PostGIS equivalent "{{{&>}}}"
     233 * {{{left}}}
     234   * Returns true if A's bounding box is strictly to the left of B's bounding box.
     235   * PostGIS equivalent "{{{<<}}}"
     236 * {{{right}}}
     237   * Returns true if A's bounding box is strictly to the right of B's bounding box.
     238   * PostGIS equivalent "{{{>>}}}"
     239 * {{{overlapsbelow}}}
     240   * Returns true if A's bounding box overlaps or is below B's bounding box.
     241   * PostGIS equivalent "{{{&<|}}}"
     242 * {{{overlapsabove}}}
     243   * Returns true if A's bounding box overlaps or is above B's bounding box.
     244   * PostGIS equivalent "{{{|&>}}}"
     245 * {{{strictlybelow}}}
     246   * Returns true if A's bounding box is strictly below B's bounding box.
     247   * PostGIS equivalent "{{{<<|}}}"
     248 * {{{strictlyabove}}}
     249   * Returns true if A's bounding box is strictly above B's bounding box.
     250   * PostGIS equivalent "{{{|>>}}}"
     251 * {{{sameas}}}
     252   * The "same as" operator. It tests actual geometric equality of two features. So if A and B are the same feature, vertex-by-vertex, the operator returns true.
     253   * PostGIS equivalent "{{{~=}}}"
     254 * {{{contained}}}
     255   * Returns true if A's bounding box is completely contained by B's bounding box.
     256   * PostGIS equivalent "{{{@}}}"
     257 * {{{bbcontains}}}
     258   * Returns true if A's bounding box completely contains B's bounding box.
     259   * PostGIS equivalent "{{{~}}}"
     260 * {{{bboverlaps}}}
     261   * Returns true if A's bounding box overlaps B's bounding box.
     262   * PostGIS equivalent "{{{&&}}}"
     263
     264== PostGIS GEOS Function Field Lookup Types ==
     265 * ''See generally'' "Geometry Relationship Functions", PostGIS Documentation at Ch. 6.1.2.  This documentation will be updated completely with the content from the aforementioned PostGIS docs.
     266 * {{{distance}}}
     267   * Return the cartesian distance between two geometries in projected units.
     268   * PostGIS equivalent {{{Distance(geometry, geometry)}}}
     269 * {{{equals}}}
     270   * Requires GEOS
     271   * Returns 1 (TRUE) if the given Geometries are "spatially equal".
     272   * Use this for a 'better' answer than '='. equals('LINESTRING(0 0, 10 10)','LINESTRING(0 0, 5 5, 10 10)') is true.
     273   * PostGIS equivalent {{{Equals(geometry, geometry)}}}, OGC SPEC s2.1.1.2
     274 * {{{disjoint}}}
     275   * Requires GEOS
     276   * Returns 1 (TRUE) if the Geometries are "spatially disjoint".
     277   *
     278   * PostGIS equivalent {{{Disjoint(geometry, geometry)}}}
     279 * {{{intersects}}}
     280   * PostGIS equivalent {{{Intersects(geometry, geometry)}}}
     281 * {{{touches}}}
     282   * PostGIS equivalent {{{Touches(geometry, geometry)}}}
     283 * {{{crosses}}}
     284   * PostGIS equivalent {{{Crosses(geometry, geometry)}}}
     285 * {{{overlaps}}}
     286   * PostGIS equivalent {{{Overlaps(geometry, geometry)}}}
     287 * {{{contains}}}
     288   * PostGIS equivalent {{{Contains(geometry, geometry)}}}
     289 * {{{intersects}}}
     290   * PostGIS equivalent {{{Intersects(geometry, geometry)}}}
     291 * {{{relate}}}
     292   * PostGIS equivelent {{{Relate(geometry, geometry)}}}
Back to Top