Changes between Version 1 and Version 2 of GEOSGeometry


Ignore:
Timestamp:
Aug 8, 2007, 9:23:49 AM (17 years ago)
Author:
jbronn
Comment:

filled in some documentation on Point, LineString and geometry creation

Legend:

Unmodified
Added
Removed
Modified
  • GEOSGeometry

    v1 v2  
    66=== What is GEOS? ===
    77
    8 [http://geos.refractions.net/ GEOS] stands for '''G'''eometry '''E'''ngine - '''O'''pen '''S'''ource, and is a C++ port of the [http://www.jump-project.org/project.php?PID=JTS&SID=OVER Java Topology Suite], implementing the OpenGIS [http://www.opengeospatial.org/standards/sfs Simple Features for SQL] spatial predicate functions and spatial operators.
     8[http://geos.refractions.net/ GEOS] stands for '''G'''eometry '''E'''ngine - '''O'''pen '''S'''ource, and is a C++ port of the [http://www.jump-project.org/project.php?PID=JTS&SID=OVER Java Topology Suite], implementing the OpenGIS [http://www.opengeospatial.org/standards/sfs Simple Features for SQL] spatial predicate functions and spatial operators.  GEOS is developed and maintained by [http://www.refractions.net/ Refractions Research] of Victoria, Canada.
    99
    1010=== Why the new API? ===
     
    1414 3. Cross-platform compatibility.
    1515
    16 Thus, the Python {{{ctypes}}} package was used to wrap the [http://geos.refractions.net/ro/doxygen_docs/html/geos__c_8h-source.html GEOS C API] to bring the rich capabilities of GEOS to Python and GeoDjango.
     16Thus, the Python {{{ctypes}}} package was used to wrap the [http://geos.refractions.net/ro/doxygen_docs/html/geos__c_8h-source.html GEOS C API] to bring the rich capabilities of GEOS to Python and !GeoDjango.
     17
     18''Features'':
     19 * A BSD licensed interface to the GEOS geometry routines, implemented purely in Python using {{{ctypes}}}.
     20 * Loosely-coupled to !GeoDjango, ''e.g.'', GEOS geometry objects may be used outside a django project/application (no need have {{{DJANGO_SETTINGS_MODULE}}} set).
     21 * Mutability.  GEOS Geometry objects may be modified, and memory is safely re-used when possible.
     22 * Cross-platform and tested.  !GeoDjango GEOS geometries are well-tested and compatible with Windows, Linux, Solaris, and Mac OSX platforms.
    1723
    1824=== Related Work ===
     
    2228=== Point ===
    2329
    24 === LineString ===
     30The Point object may be initialized with either a tuple, or individual parameters.  For example:
     31{{{
     32#!python
     33>>> from django.contrib.gis.geos import Point
     34>>> p = Point((5, 23)) # 2D point, passed in as a tuple
     35>>> p = Point(5, 23, 8) # 3D point, passed in with individual parameters
     36}}}
    2537
    26 === LinearRing ===
     38=== !LineString ===
     39
     40Initializes on the given sequence, for example, the constructor may take lists, tuples, !NumPy arrays of X,Y[,Z] pairs, or {{{Point}}} objects.  If {{{Point}}} objects are used, ownership of the points is ''not'' transferred to the {{{LineString}}} object.  Examples:
     41
     42{{{
     43#!python
     44>>> from django.contrib.gis.geos import LineString, Point
     45>>> ls = LineString((1, 1), (2, 2))
     46>>> ls = LineString([(1, 1), (2, 2)])
     47>>> ls = LineString(Point(1, 1), Point(2, 2))
     48>>> from numpy import array
     49>>> ls = LineString(array([(1, 1), (2, 2)]))
     50}}}
     51
     52=== !LinearRing ===
    2753
    2854=== Polygon ===
     
    3056== Geometry Collections ==
    3157
    32 === MultiPoint ===
     58=== !MultiPoint ===
    3359
    34 === MultiLineString ===
     60=== !MultiLineString ===
    3561
    36 === MultiPolygon ===
     62=== !MultiPolygon ===
    3763
    38 === GeometryCollection ===
     64=== !GeometryCollection ===
    3965
    4066== API ==
    4167
    4268=== Creation ===
     69
     70GEOS geometry objects may be created from strings using the {{{fromstr()}}} factory, or using the constructor for each geometry object (as described above).
     71{{{
     72#!python
     73>>> from django.contrib.gis.geos import fromstr
     74>>> pnt = fromstr('POINT(-90.5 29.5)', srid=4326)
     75}}}
     76The {{{srid}}} keyword may be used to set the spatial reference system identifier number for the geometry.  This will be used to conduct any needed transformations for spatial lookups and geographic model creation.  It should be noted that {{{fromstr}}} is a shortcut to the constructor for the base {{{GEOSGeometry}}} object.
     77
     78=== Output Properties ===
     79 * {{{wkt}}}: Returns the Well-Known Text of the geometry (an OGC standard).
     80 * {{{hex}}}: Returns the HEXEWKB PostGIS canonical representation of the geometry.  This representation is specific to PostGIS, and is not a standard.
     81 * {{{kml}}}: Returns a KML (Keyhole Markup Language) representation of the geometry.  Should only be used for geometries with an SRID of 4326 (WGS84), but this restriction is not enforced.
    4382
    4483=== Spatial Predicate Properties ===
Back to Top