Fixed #25974 -- Switched GIS docs to 4 spaces indentation.

This commit is contained in:
Sergey Fedoseev 2016-02-19 12:31:25 +05:00 committed by Tim Graham
parent dbaa1a6b59
commit 23e1ad537a
19 changed files with 929 additions and 944 deletions

View File

@ -3,67 +3,67 @@ GeoDjango's admin site
======================
.. module:: django.contrib.gis.admin
:synopsis: GeoDjango's extensions to the admin site.
:synopsis: GeoDjango's extensions to the admin site.
``GeoModelAdmin``
=================
.. class:: GeoModelAdmin
.. attribute:: default_lon
.. attribute:: default_lon
The default center longitude.
The default center longitude.
.. attribute:: default_lat
.. attribute:: default_lat
The default center latitude.
The default center latitude.
.. attribute:: default_zoom
.. attribute:: default_zoom
The default zoom level to use. Defaults to 18.
The default zoom level to use. Defaults to 18.
.. attribute:: extra_js
.. attribute:: extra_js
Sequence of URLs to any extra JavaScript to include.
Sequence of URLs to any extra JavaScript to include.
.. attribute:: map_template
.. attribute:: map_template
Override the template used to generate the JavaScript slippy map.
Default is ``'gis/admin/openlayers.html'``.
Override the template used to generate the JavaScript slippy map.
Default is ``'gis/admin/openlayers.html'``.
.. attribute:: map_width
.. attribute:: map_width
Width of the map, in pixels. Defaults to 600.
Width of the map, in pixels. Defaults to 600.
.. attribute:: map_height
.. attribute:: map_height
Height of the map, in pixels. Defaults to 400.
Height of the map, in pixels. Defaults to 400.
.. attribute:: openlayers_url
.. attribute:: openlayers_url
Link to the URL of the OpenLayers JavaScript. Defaults to
``'http://openlayers.org/api/2.13.1/OpenLayers.js'``.
Link to the URL of the OpenLayers JavaScript. Defaults to
``'http://openlayers.org/api/2.13.1/OpenLayers.js'``.
.. attribute:: modifiable
.. attribute:: modifiable
Defaults to ``True``. When set to ``False``, disables editing of
existing geometry fields in the admin.
Defaults to ``True``. When set to ``False``, disables editing of
existing geometry fields in the admin.
.. note::
.. note::
This is different from adding the geometry field to
:attr:`~django.contrib.admin.ModelAdmin.readonly_fields`,
which will only display the WKT of the geometry. Setting
``modifiable=False``, actually displays the geometry in a map,
but disables the ability to edit its vertices.
This is different from adding the geometry field to
:attr:`~django.contrib.admin.ModelAdmin.readonly_fields`,
which will only display the WKT of the geometry. Setting
``modifiable=False``, actually displays the geometry in a map,
but disables the ability to edit its vertices.
``OSMGeoAdmin``
===============
.. class:: OSMGeoAdmin
A subclass of :class:`GeoModelAdmin` that uses a spherical mercator projection
with `OpenStreetMap <https://www.openstreetmap.org/>`_ street data tiles.
See the :ref:`OSMGeoAdmin introduction <osmgeoadmin-intro>`
in the tutorial for a usage example.
A subclass of :class:`GeoModelAdmin` that uses a spherical mercator projection
with `OpenStreetMap <https://www.openstreetmap.org/>`_ street data tiles.
See the :ref:`OSMGeoAdmin introduction <osmgeoadmin-intro>`
in the tutorial for a usage example.

View File

@ -24,59 +24,59 @@ of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`.
.. django-admin-option:: --blank BLANK
Use a comma separated list of OGR field names to add the ``blank=True``
keyword option to the field definition. Set with ``true`` to apply
to all applicable fields.
Use a comma separated list of OGR field names to add the ``blank=True``
keyword option to the field definition. Set with ``true`` to apply
to all applicable fields.
.. django-admin-option:: --decimal DECIMAL
Use a comma separated list of OGR float fields to generate
:class:`~django.db.models.DecimalField` instead of the default
:class:`~django.db.models.FloatField`. Set to ``true`` to apply to all
OGR float fields.
Use a comma separated list of OGR float fields to generate
:class:`~django.db.models.DecimalField` instead of the default
:class:`~django.db.models.FloatField`. Set to ``true`` to apply to all
OGR float fields.
.. django-admin-option:: --geom-name GEOM_NAME
Specifies the model attribute name to use for the geometry field.
Defaults to ``'geom'``.
Specifies the model attribute name to use for the geometry field.
Defaults to ``'geom'``.
.. django-admin-option:: --layer LAYER_KEY
The key for specifying which layer in the OGR
:class:`~django.contrib.gis.gdal.DataSource` source to use.
Defaults to 0 (the first layer). May be an integer or a string identifier
for the :class:`~django.contrib.gis.gdal.Layer`. When inspecting databases,
``layer`` is generally the table name you want to inspect.
The key for specifying which layer in the OGR
:class:`~django.contrib.gis.gdal.DataSource` source to use.
Defaults to 0 (the first layer). May be an integer or a string identifier
for the :class:`~django.contrib.gis.gdal.Layer`. When inspecting databases,
``layer`` is generally the table name you want to inspect.
.. django-admin-option:: --mapping
Automatically generate a mapping dictionary for use with
:class:`~django.contrib.gis.utils.LayerMapping`.
Automatically generate a mapping dictionary for use with
:class:`~django.contrib.gis.utils.LayerMapping`.
.. django-admin-option:: --multi-geom
When generating the geometry field, treat it as a geometry collection.
For example, if this setting is enabled then a
:class:`~django.contrib.gis.db.models.MultiPolygonField` will be placed
in the generated model rather than
:class:`~django.contrib.gis.db.models.PolygonField`.
When generating the geometry field, treat it as a geometry collection.
For example, if this setting is enabled then a
:class:`~django.contrib.gis.db.models.MultiPolygonField` will be placed
in the generated model rather than
:class:`~django.contrib.gis.db.models.PolygonField`.
.. django-admin-option:: --name-field NAME_FIELD
Generates a ``__str__`` routine (``__unicode__`` on Python 2) on the model
that will return the given field name.
Generates a ``__str__`` routine (``__unicode__`` on Python 2) on the model
that will return the given field name.
.. django-admin-option:: --no-imports
Suppresses the ``from django.contrib.gis.db import models`` import statement.
Suppresses the ``from django.contrib.gis.db import models`` import statement.
.. django-admin-option:: --null NULL
Use a comma separated list of OGR field names to add the ``null=True``
keyword option to the field definition. Set with ``true`` to apply to
all applicable fields.
Use a comma separated list of OGR field names to add the ``null=True``
keyword option to the field definition. Set with ``true`` to apply to
all applicable fields.
.. django-admin-option:: --srid SRID
The SRID to use for the geometry field. If not set, ``ogrinspect`` attempts
to automatically determine of the SRID of the data source.
The SRID to use for the geometry field. If not set, ``ogrinspect`` attempts
to automatically determine of the SRID of the data source.

View File

@ -8,7 +8,7 @@ Spatial Backends
================
.. module:: django.contrib.gis.db.backends
:synopsis: GeoDjango's spatial database backends.
:synopsis: GeoDjango's spatial database backends.
GeoDjango currently provides the following spatial database backends:
@ -18,7 +18,7 @@ GeoDjango currently provides the following spatial database backends:
* ``django.contrib.gis.db.backends.spatialite``
.. module:: django.contrib.gis.db.models
:synopsis: GeoDjango's database API.
:synopsis: GeoDjango's database API.
.. _mysql-spatial-limitations:
@ -297,7 +297,7 @@ Database functions
------------------
.. module:: django.contrib.gis.db.models.functions
:synopsis: GeoDjango's database functions.
:synopsis: GeoDjango's database functions.
The following table provides a summary of what geography-specific database
functions are available on each spatial backend.
@ -360,9 +360,9 @@ Aggregate PostGIS Oracle SpatiaLite
.. [#fnmysqlidx] *See* `Creating Spatial Indexes <https://dev.mysql.com/doc/refman/5.6/en/creating-spatial-indexes.html>`_
in the MySQL Reference Manual:
For MyISAM tables, ``SPATIAL INDEX`` creates an R-tree index. For storage
engines that support nonspatial indexing of spatial columns, the engine
creates a B-tree index. A B-tree index on spatial values will be useful
for exact-value lookups, but not for range scans.
For MyISAM tables, ``SPATIAL INDEX`` creates an R-tree index. For storage
engines that support nonspatial indexing of spatial columns, the engine
creates a B-tree index. A B-tree index on spatial values will be useful
for exact-value lookups, but not for range scans.
.. [#] Refer :ref:`mysql-spatial-limitations` section for more details.

View File

@ -3,7 +3,7 @@ Geographic Feeds
================
.. module:: django.contrib.gis.feeds
:synopsis: GeoDjango's framework for generating spatial feeds.
:synopsis: GeoDjango's framework for generating spatial feeds.
GeoDjango has its own :class:`Feed` subclass that may embed location information
in RSS/Atom feeds formatted according to either the `Simple GeoRSS`__ or
@ -26,10 +26,10 @@ API Reference
.. class:: Feed
In addition to methods provided by
the :class:`django.contrib.syndication.views.Feed`
base class, GeoDjango's ``Feed`` class provides
the following overrides. Note that these overrides may be done in multiple ways::
In addition to methods provided by the
:class:`django.contrib.syndication.views.Feed` base class, GeoDjango's
``Feed`` class provides the following overrides. Note that these overrides
may be done in multiple ways::
from django.contrib.gis.feeds import Feed
@ -53,23 +53,23 @@ API Reference
def item_geometry(self, item):
...
.. method:: geometry(obj)
.. method:: geometry(obj)
Takes the object returned by ``get_object()`` and returns the *feed's*
geometry. Typically this is a ``GEOSGeometry`` instance, or can be a
tuple to represent a point or a box. For example::
Takes the object returned by ``get_object()`` and returns the *feed's*
geometry. Typically this is a ``GEOSGeometry`` instance, or can be a tuple
to represent a point or a box. For example::
class ZipcodeFeed(Feed):
class ZipcodeFeed(Feed):
def geometry(self, obj):
# Can also return: `obj.poly`, and `obj.poly.centroid`.
return obj.poly.extent # tuple like: (X0, Y0, X1, Y1).
def geometry(self, obj):
# Can also return: `obj.poly`, and `obj.poly.centroid`.
return obj.poly.extent # tuple like: (X0, Y0, X1, Y1).
.. method:: item_geometry(item)
.. method:: item_geometry(item)
Set this to return the geometry for each *item* in the feed. This
can be a ``GEOSGeometry`` instance, or a tuple that represents a
point coordinate or bounding box. For example::
Set this to return the geometry for each *item* in the feed. This can be a
``GEOSGeometry`` instance, or a tuple that represents a point coordinate or
bounding box. For example::
class ZipcodeFeed(Feed):

View File

@ -3,7 +3,7 @@ GeoDjango Forms API
===================
.. module:: django.contrib.gis.forms
:synopsis: GeoDjango forms API.
:synopsis: GeoDjango forms API.
GeoDjango provides some specialized form fields and widgets in order to visually
display and edit geolocalized data on a map. By default, they use
@ -83,7 +83,7 @@ Form widgets
============
.. module:: django.contrib.gis.widgets
:synopsis: GeoDjango widgets API.
:synopsis: GeoDjango widgets API.
GeoDjango form widgets allow you to display and edit geographic data on a
visual map.

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ Geolocation with GeoIP
======================
.. module:: django.contrib.gis.geoip
:synopsis: High-level Python interface for MaxMind's GeoIP C library.
:synopsis: High-level Python interface for MaxMind's GeoIP C library.
.. deprecated:: 1.9
@ -33,27 +33,27 @@ Example
Assuming you have the GeoIP C library installed, here is an example of its
usage::
>>> from django.contrib.gis.geoip import GeoIP
>>> g = GeoIP()
>>> g.country('google.com')
{'country_code': 'US', 'country_name': 'United States'}
>>> g.city('72.14.207.99')
{'area_code': 650,
'city': 'Mountain View',
'country_code': 'US',
'country_code3': 'USA',
'country_name': 'United States',
'dma_code': 807,
'latitude': 37.419200897216797,
'longitude': -122.05740356445312,
'postal_code': '94043',
'region': 'CA'}
>>> g.lat_lon('salon.com')
(37.789798736572266, -122.39420318603516)
>>> g.lon_lat('uh.edu')
(-95.415199279785156, 29.77549934387207)
>>> g.geos('24.124.1.80').wkt
'POINT (-95.2087020874023438 39.0392990112304688)'
>>> from django.contrib.gis.geoip import GeoIP
>>> g = GeoIP()
>>> g.country('google.com')
{'country_code': 'US', 'country_name': 'United States'}
>>> g.city('72.14.207.99')
{'area_code': 650,
'city': 'Mountain View',
'country_code': 'US',
'country_code3': 'USA',
'country_name': 'United States',
'dma_code': 807,
'latitude': 37.419200897216797,
'longitude': -122.05740356445312,
'postal_code': '94043',
'region': 'CA'}
>>> g.lat_lon('salon.com')
(37.789798736572266, -122.39420318603516)
>>> g.lon_lat('uh.edu')
(-95.415199279785156, 29.77549934387207)
>>> g.geos('24.124.1.80').wkt
'POINT (-95.2087020874023438 39.0392990112304688)'
``GeoIP`` Settings
==================

View File

@ -3,7 +3,7 @@ Geolocation with GeoIP2
=======================
.. module:: django.contrib.gis.geoip2
:synopsis: Python interface for MaxMind's GeoIP2 databases.
:synopsis: Python interface for MaxMind's GeoIP2 databases.
.. versionadded:: 1.9
@ -29,25 +29,25 @@ Example
Here is an example of its usage::
>>> from django.contrib.gis.geoip2 import GeoIP2
>>> g = GeoIP2()
>>> g.country('google.com')
{'country_code': 'US', 'country_name': 'United States'}
>>> g.city('72.14.207.99')
{'city': 'Mountain View',
'country_code': 'US',
'country_name': 'United States',
'dma_code': 807,
'latitude': 37.419200897216797,
'longitude': -122.05740356445312,
'postal_code': '94043',
'region': 'CA'}
>>> g.lat_lon('salon.com')
(39.0437, -77.4875)
>>> g.lon_lat('uh.edu')
(-95.4342, 29.834)
>>> g.geos('24.124.1.80').wkt
'POINT (-97.0000000000000000 38.0000000000000000)'
>>> from django.contrib.gis.geoip2 import GeoIP2
>>> g = GeoIP2()
>>> g.country('google.com')
{'country_code': 'US', 'country_name': 'United States'}
>>> g.city('72.14.207.99')
{'city': 'Mountain View',
'country_code': 'US',
'country_name': 'United States',
'dma_code': 807,
'latitude': 37.419200897216797,
'longitude': -122.05740356445312,
'postal_code': '94043',
'region': 'CA'}
>>> g.lat_lon('salon.com')
(39.0437, -77.4875)
>>> g.lon_lat('uh.edu')
(-95.4342, 29.834)
>>> g.geos('24.124.1.80').wkt
'POINT (-97.0000000000000000 38.0000000000000000)'
``GeoIP`` Settings
==================

View File

@ -1308,9 +1308,9 @@ Returns a ``LineString`` constructed from the point field geometries in the
Example::
>>> print(City.objects.filter(name__in=('Houston', 'Dallas')
... ).aggregate(MakeLine('poly'))['poly__makeline']
LINESTRING (-95.3631510000000020 29.7633739999999989, -96.8016109999999941 32.7820570000000018)
>>> qs = City.objects.filter(name__in=('Houston', 'Dallas')).aggregate(MakeLine('poly'))
>>> print(qs['poly__makeline'])
LINESTRING (-95.3631510000000020 29.7633739999999989, -96.8016109999999941 32.7820570000000018)
``Union``
~~~~~~~~~

View File

@ -3,7 +3,7 @@ GEOS API
========
.. module:: django.contrib.gis.geos
:synopsis: GeoDjango's high-level interface to the GEOS library.
:synopsis: GeoDjango's high-level interface to the GEOS library.
Background
==========
@ -162,13 +162,13 @@ Geometries support set-like operators::
it requires the compared geometries to have the same coordinates in the
same positions::
>>> from django.contrib.gis.geos import LineString
>>> ls1 = LineString((0, 0), (1, 1))
>>> ls2 = LineString((1, 1), (0, 0))
>>> ls1.equals(ls2)
True
>>> ls1 == ls2
False
>>> from django.contrib.gis.geos import LineString
>>> ls1 = LineString((0, 0), (1, 1))
>>> ls2 = LineString((1, 1), (0, 0))
>>> ls1.equals(ls2)
True
>>> ls1 == ls2
False
Geometry Objects
================
@ -308,8 +308,8 @@ Essentially the SRID is prepended to the WKT representation, for example
.. note::
The output from this property does not include the 3dm, 3dz, and 4d
information that PostGIS supports in its EWKT representations.
The output from this property does not include the 3dm, 3dz, and 4d
information that PostGIS supports in its EWKT representations.
.. attribute:: GEOSGeometry.hex
@ -645,99 +645,99 @@ is returned instead.
.. class:: Point(x=None, y=None, z=None, srid=None)
``Point`` objects are instantiated using arguments that represent
the component coordinates of the point or with a single sequence
coordinates. For example, the following are equivalent::
``Point`` objects are instantiated using arguments that represent the
component coordinates of the point or with a single sequence coordinates.
For example, the following are equivalent::
>>> pnt = Point(5, 23)
>>> pnt = Point([5, 23])
>>> pnt = Point(5, 23)
>>> pnt = Point([5, 23])
Empty ``Point`` objects may be instantiated by passing no arguments or an
empty sequence. The following are equivalent::
Empty ``Point`` objects may be instantiated by passing no arguments or an
empty sequence. The following are equivalent::
>>> pnt = Point()
>>> pnt = Point([])
>>> pnt = Point()
>>> pnt = Point([])
.. versionchanged:: 1.10
.. versionchanged:: 1.10
In previous versions, an empty ``Point`` couldn't be instantiated.
In previous versions, an empty ``Point`` couldn't be instantiated.
``LineString``
--------------
.. class:: LineString(*args, **kwargs)
``LineString`` objects are instantiated using arguments that are
either a sequence of coordinates or :class:`Point` objects.
For example, the following are equivalent::
``LineString`` objects are instantiated using arguments that are either a
sequence of coordinates or :class:`Point` objects. For example, the
following are equivalent::
>>> ls = LineString((0, 0), (1, 1))
>>> ls = LineString(Point(0, 0), Point(1, 1))
>>> ls = LineString((0, 0), (1, 1))
>>> ls = LineString(Point(0, 0), Point(1, 1))
In addition, ``LineString`` objects may also be created by passing
in a single sequence of coordinate or :class:`Point` objects::
In addition, ``LineString`` objects may also be created by passing in a
single sequence of coordinate or :class:`Point` objects::
>>> ls = LineString( ((0, 0), (1, 1)) )
>>> ls = LineString( [Point(0, 0), Point(1, 1)] )
>>> ls = LineString( ((0, 0), (1, 1)) )
>>> ls = LineString( [Point(0, 0), Point(1, 1)] )
Empty ``LineString`` objects may be instantiated by passing no arguments
or an empty sequence. The following are equivalent::
Empty ``LineString`` objects may be instantiated by passing no arguments
or an empty sequence. The following are equivalent::
>>> ls = LineString()
>>> ls = LineString([])
>>> ls = LineString()
>>> ls = LineString([])
.. versionchanged:: 1.10
.. versionchanged:: 1.10
In previous versions, an empty ``LineString`` couldn't be instantiated.
In previous versions, an empty ``LineString`` couldn't be instantiated.
.. attribute:: closed
.. attribute:: closed
.. versionadded:: 1.10
.. versionadded:: 1.10
Returns whether or not this ``LineString`` is closed.
Returns whether or not this ``LineString`` is closed.
``LinearRing``
--------------
.. class:: LinearRing(*args, **kwargs)
``LinearRing`` objects are constructed in the exact same way as
:class:`LineString` objects, however the coordinates must be
*closed*, in other words, the first coordinates must be the
same as the last coordinates. For example::
``LinearRing`` objects are constructed in the exact same way as
:class:`LineString` objects, however the coordinates must be *closed*, in
other words, the first coordinates must be the same as the last
coordinates. For example::
>>> ls = LinearRing((0, 0), (0, 1), (1, 1), (0, 0))
>>> ls = LinearRing((0, 0), (0, 1), (1, 1), (0, 0))
Notice that ``(0, 0)`` is the first and last coordinate -- if
they were not equal, an error would be raised.
Notice that ``(0, 0)`` is the first and last coordinate -- if they were not
equal, an error would be raised.
``Polygon``
-----------
.. class:: Polygon(*args, **kwargs)
``Polygon`` objects may be instantiated by passing in parameters that
represent the rings of the polygon. The parameters must either be
:class:`LinearRing` instances, or a sequence that may be used to construct a
:class:`LinearRing`::
``Polygon`` objects may be instantiated by passing in parameters that
represent the rings of the polygon. The parameters must either be
:class:`LinearRing` instances, or a sequence that may be used to construct a
:class:`LinearRing`::
>>> ext_coords = ((0, 0), (0, 1), (1, 1), (1, 0), (0, 0))
>>> int_coords = ((0.4, 0.4), (0.4, 0.6), (0.6, 0.6), (0.6, 0.4), (0.4, 0.4))
>>> poly = Polygon(ext_coords, int_coords)
>>> poly = Polygon(LinearRing(ext_coords), LinearRing(int_coords))
>>> ext_coords = ((0, 0), (0, 1), (1, 1), (1, 0), (0, 0))
>>> int_coords = ((0.4, 0.4), (0.4, 0.6), (0.6, 0.6), (0.6, 0.4), (0.4, 0.4))
>>> poly = Polygon(ext_coords, int_coords)
>>> poly = Polygon(LinearRing(ext_coords), LinearRing(int_coords))
.. versionchanged:: 1.10
.. versionchanged:: 1.10
In previous versions, an empty ``Polygon`` couldn't be instantiated.
In previous versions, an empty ``Polygon`` couldn't be instantiated.
.. classmethod:: from_bbox(bbox)
.. classmethod:: from_bbox(bbox)
Returns a polygon object from the given bounding-box, a 4-tuple
comprising ``(xmin, ymin, xmax, ymax)``.
Returns a polygon object from the given bounding-box, a 4-tuple
comprising ``(xmin, ymin, xmax, ymax)``.
.. attribute:: num_interior_rings
.. attribute:: num_interior_rings
Returns the number of interior rings in this geometry.
Returns the number of interior rings in this geometry.
.. admonition:: Comparing Polygons
@ -758,92 +758,92 @@ Geometry Collections
.. class:: MultiPoint(*args, **kwargs)
``MultiPoint`` objects may be instantiated by passing in :class:`Point`
objects as arguments, or a single sequence of :class:`Point` objects::
``MultiPoint`` objects may be instantiated by passing in :class:`Point`
objects as arguments, or a single sequence of :class:`Point` objects::
>>> mp = MultiPoint(Point(0, 0), Point(1, 1))
>>> mp = MultiPoint( (Point(0, 0), Point(1, 1)) )
>>> mp = MultiPoint(Point(0, 0), Point(1, 1))
>>> mp = MultiPoint( (Point(0, 0), Point(1, 1)) )
.. versionchanged:: 1.10
.. versionchanged:: 1.10
In previous versions, an empty ``MultiPoint`` couldn't be instantiated.
In previous versions, an empty ``MultiPoint`` couldn't be instantiated.
``MultiLineString``
-------------------
.. class:: MultiLineString(*args, **kwargs)
``MultiLineString`` objects may be instantiated by passing in
:class:`LineString` objects as arguments, or a single sequence of
:class:`LineString` objects::
``MultiLineString`` objects may be instantiated by passing in
:class:`LineString` objects as arguments, or a single sequence of
:class:`LineString` objects::
>>> ls1 = LineString((0, 0), (1, 1))
>>> ls2 = LineString((2, 2), (3, 3))
>>> mls = MultiLineString(ls1, ls2)
>>> mls = MultiLineString([ls1, ls2])
>>> ls1 = LineString((0, 0), (1, 1))
>>> ls2 = LineString((2, 2), (3, 3))
>>> mls = MultiLineString(ls1, ls2)
>>> mls = MultiLineString([ls1, ls2])
.. versionchanged:: 1.10
.. versionchanged:: 1.10
In previous versions, an empty ``MultiLineString`` couldn't be
instantiated.
In previous versions, an empty ``MultiLineString`` couldn't be
instantiated.
.. attribute:: merged
.. attribute:: merged
Returns a :class:`LineString` representing the line merge of
all the components in this ``MultiLineString``.
Returns a :class:`LineString` representing the line merge of
all the components in this ``MultiLineString``.
.. attribute:: closed
.. attribute:: closed
.. versionadded:: 1.10
.. versionadded:: 1.10
Returns ``True`` if and only if all elements are closed. Requires GEOS 3.5.
Returns ``True`` if and only if all elements are closed. Requires GEOS 3.5.
``MultiPolygon``
----------------
.. class:: MultiPolygon(*args, **kwargs)
``MultiPolygon`` objects may be instantiated by passing :class:`Polygon`
objects as arguments, or a single sequence of :class:`Polygon` objects::
``MultiPolygon`` objects may be instantiated by passing :class:`Polygon`
objects as arguments, or a single sequence of :class:`Polygon` objects::
>>> p1 = Polygon( ((0, 0), (0, 1), (1, 1), (0, 0)) )
>>> p2 = Polygon( ((1, 1), (1, 2), (2, 2), (1, 1)) )
>>> mp = MultiPolygon(p1, p2)
>>> mp = MultiPolygon([p1, p2])
>>> p1 = Polygon( ((0, 0), (0, 1), (1, 1), (0, 0)) )
>>> p2 = Polygon( ((1, 1), (1, 2), (2, 2), (1, 1)) )
>>> mp = MultiPolygon(p1, p2)
>>> mp = MultiPolygon([p1, p2])
.. versionchanged:: 1.10
.. versionchanged:: 1.10
In previous versions, an empty ``MultiPolygon`` couldn't be
instantiated.
In previous versions, an empty ``MultiPolygon`` couldn't be
instantiated.
.. attribute:: cascaded_union
.. attribute:: cascaded_union
.. deprecated:: 1.10
.. deprecated:: 1.10
Use the :attr:`GEOSGeometry.unary_union` property instead.
Use the :attr:`GEOSGeometry.unary_union` property instead.
Returns a :class:`Polygon` that is the union of all of the component
polygons in this collection. The algorithm employed is significantly
more efficient (faster) than trying to union the geometries together
individually. [#fncascadedunion]_
Returns a :class:`Polygon` that is the union of all of the component
polygons in this collection. The algorithm employed is significantly
more efficient (faster) than trying to union the geometries together
individually. [#fncascadedunion]_
``GeometryCollection``
----------------------
.. class:: GeometryCollection(*args, **kwargs)
``GeometryCollection`` objects may be instantiated by passing in other
:class:`GEOSGeometry` as arguments, or a single sequence of
:class:`GEOSGeometry` objects::
``GeometryCollection`` objects may be instantiated by passing in other
:class:`GEOSGeometry` as arguments, or a single sequence of
:class:`GEOSGeometry` objects::
>>> poly = Polygon( ((0, 0), (0, 1), (1, 1), (0, 0)) )
>>> gc = GeometryCollection(Point(0, 0), MultiPoint(Point(0, 0), Point(1, 1)), poly)
>>> gc = GeometryCollection((Point(0, 0), MultiPoint(Point(0, 0), Point(1, 1)), poly))
>>> poly = Polygon( ((0, 0), (0, 1), (1, 1), (0, 0)) )
>>> gc = GeometryCollection(Point(0, 0), MultiPoint(Point(0, 0), Point(1, 1)), poly)
>>> gc = GeometryCollection((Point(0, 0), MultiPoint(Point(0, 0), Point(1, 1)), poly))
.. versionchanged:: 1.10
.. versionchanged:: 1.10
In previous versions, an empty ``GeometryCollection`` couldn't be
instantiated.
In previous versions, an empty ``GeometryCollection`` couldn't be
instantiated.
.. _prepared-geometries:
@ -897,9 +897,9 @@ Geometry Factories
.. function:: fromfile(file_h)
:param file_h: input file that contains spatial data
:type file_h: a Python ``file`` object or a string path to the file
:rtype: a :class:`GEOSGeometry` corresponding to the spatial data in the file
:param file_h: input file that contains spatial data
:type file_h: a Python ``file`` object or a string path to the file
:rtype: a :class:`GEOSGeometry` corresponding to the spatial data in the file
Example::
@ -908,11 +908,11 @@ Example::
.. function:: fromstr(string, srid=None)
:param string: string that contains spatial data
:type string: string
:param srid: spatial reference identifier
:type srid: int
:rtype: a :class:`GEOSGeometry` corresponding to the spatial data in the string
:param string: string that contains spatial data
:type string: string
:param srid: spatial reference identifier
:type srid: int
:rtype: a :class:`GEOSGeometry` corresponding to the spatial data in the string
``fromstr(string, srid)`` is equivalent to :class:`GEOSGeometry(string, srid)
<GEOSGeometry>`.

View File

@ -3,31 +3,31 @@ GeoDjango
=========
.. module:: django.contrib.gis
:synopsis: Geographic Information System (GIS) extensions for Django
:synopsis: Geographic Information System (GIS) extensions for Django
GeoDjango intends to be a world-class geographic Web framework. Its goal is to
make it as easy as possible to build GIS Web applications and harness the power
of spatially enabled data.
.. toctree::
:maxdepth: 2
:maxdepth: 2
tutorial
install/index
model-api
db-api
forms-api
geoquerysets
functions
measure
geos
gdal
geoip
geoip2
utils
commands
admin
feeds
sitemaps
testing
deployment
tutorial
install/index
model-api
db-api
forms-api
geoquerysets
functions
measure
geos
gdal
geoip
geoip2
utils
commands
admin
feeds
sitemaps
testing
deployment

View File

@ -82,11 +82,11 @@ is required.
.. note::
On Linux platforms, it may be necessary to run the ``ldconfig``
command after installing each library. For example::
On Linux platforms, it may be necessary to run the ``ldconfig`` command
after installing each library. For example::
$ sudo make install
$ sudo ldconfig
$ sudo make install
$ sudo ldconfig
.. note::
@ -210,10 +210,10 @@ Configure, make and install::
.. note::
Because GeoDjango has its own Python interface, the preceding instructions
do not build GDAL's own Python bindings. The bindings may be built by
adding the ``--with-python`` flag when running ``configure``. See
`GDAL/OGR In Python`__ for more information on GDAL's bindings.
Because GeoDjango has its own Python interface, the preceding instructions
do not build GDAL's own Python bindings. The bindings may be built by
adding the ``--with-python`` flag when running ``configure``. See
`GDAL/OGR In Python`__ for more information on GDAL's bindings.
If you have any problems, please see the troubleshooting section below for
suggestions and solutions.
@ -253,7 +253,6 @@ the GDAL library. For example::
GDAL_LIBRARY_PATH = '/home/sue/local/lib/libgdal.so'
.. rubric:: Footnotes
.. [#] The datum shifting files are needed for converting data to and from
certain projections.

View File

@ -76,18 +76,18 @@ Geospatial libraries
--------------------
.. toctree::
:maxdepth: 1
:maxdepth: 1
geolibs
geolibs
Database installation
---------------------
.. toctree::
:maxdepth: 1
:maxdepth: 1
postgis
spatialite
postgis
spatialite
Add ``django.contrib.gis`` to :setting:`INSTALLED_APPS`
-------------------------------------------------------
@ -480,14 +480,14 @@ executable with ``cmd.exe``, will set this up:
.. code-block:: bat
set OSGEO4W_ROOT=C:\OSGeo4W
set PYTHON_ROOT=C:\Python27
set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal
set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
set PATH=%PATH%;%PYTHON_ROOT%;%OSGEO4W_ROOT%\bin
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /f /d "%PATH%"
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v GDAL_DATA /t REG_EXPAND_SZ /f /d "%GDAL_DATA%"
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROJ_LIB /t REG_EXPAND_SZ /f /d "%PROJ_LIB%"
set OSGEO4W_ROOT=C:\OSGeo4W
set PYTHON_ROOT=C:\Python27
set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal
set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
set PATH=%PATH%;%PYTHON_ROOT%;%OSGEO4W_ROOT%\bin
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /f /d "%PATH%"
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v GDAL_DATA /t REG_EXPAND_SZ /f /d "%GDAL_DATA%"
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROJ_LIB /t REG_EXPAND_SZ /f /d "%PROJ_LIB%"
For your convenience, these commands are available in the executable batch
script, :download:`geodjango_setup.bat`.

View File

@ -3,7 +3,7 @@
====================================
.. module:: django.contrib.gis.utils.layermapping
:synopsis: Spatial data import utility for GeoDjango models.
:synopsis: Spatial data import utility for GeoDjango models.
.. currentmodule:: django.contrib.gis.utils

View File

@ -3,7 +3,7 @@ Measurement Objects
===================
.. module:: django.contrib.gis.measure
:synopsis: GeoDjango's distance and area measurement objects.
:synopsis: GeoDjango's distance and area measurement objects.
The :mod:`django.contrib.gis.measure` module contains objects that allow
for convenient representation of distance and area units of measure. [#]_
@ -113,64 +113,64 @@ Measurement API
.. class:: Distance(**kwargs)
To initialize a distance object, pass in a keyword corresponding to
the desired :ref:`unit attribute name <supported_units>` set with
desired value. For example, the following creates a distance
object representing 5 miles::
To initialize a distance object, pass in a keyword corresponding to the
desired :ref:`unit attribute name <supported_units>` set with desired
value. For example, the following creates a distance object representing 5
miles::
>>> dist = Distance(mi=5)
>>> dist = Distance(mi=5)
.. method:: __getattr__(unit_att)
.. method:: __getattr__(unit_att)
Returns the distance value in units corresponding to the given unit
attribute. For example::
Returns the distance value in units corresponding to the given unit
attribute. For example::
>>> print(dist.km)
8.04672
>>> print(dist.km)
8.04672
.. classmethod:: unit_attname(unit_name)
.. classmethod:: unit_attname(unit_name)
Returns the distance unit attribute name for the given full unit name.
For example::
Returns the distance unit attribute name for the given full unit name. For
example::
>>> Distance.unit_attname('Mile')
'mi'
>>> Distance.unit_attname('Mile')
'mi'
.. class:: D
Alias for :class:`Distance` class.
Alias for :class:`Distance` class.
``Area``
--------
.. class:: Area(**kwargs)
To initialize an area object, pass in a keyword corresponding to
the desired :ref:`unit attribute name <supported_units>` set with
desired value. For example, the following creates an area
object representing 5 square miles::
To initialize an area object, pass in a keyword corresponding to the
desired :ref:`unit attribute name <supported_units>` set with desired
value. For example, the following creates an area object representing 5
square miles::
>>> a = Area(sq_mi=5)
>>> a = Area(sq_mi=5)
.. method:: __getattr__(unit_att)
.. method:: __getattr__(unit_att)
Returns the area value in units corresponding to the given unit
attribute. For example::
Returns the area value in units corresponding to the given unit attribute.
For example::
>>> print(a.sq_km)
12.949940551680001
>>> print(a.sq_km)
12.949940551680001
.. classmethod:: unit_attname(unit_name)
.. classmethod:: unit_attname(unit_name)
Returns the area unit attribute name for the given full unit name.
For example::
Returns the area unit attribute name for the given full unit name. For
example::
>>> Area.unit_attname('Kilometer')
'sq_km'
.. class:: A
Alias for :class:`Area` class.
Alias for :class:`Area` class.
.. rubric:: Footnotes
.. [#] `Robert Coup <https://koordinates.com/>`_ is the initial author of the measure objects,

View File

@ -3,7 +3,7 @@ GeoDjango Model API
===================
.. module:: django.contrib.gis.db.models
:synopsis: GeoDjango model and field API.
:synopsis: GeoDjango model and field API.
This document explores the details of the GeoDjango Model API. Throughout this
section, we'll be using the following geographic model of a `ZIP code`__ and

View File

@ -3,7 +3,7 @@ OGR Inspection
==============
.. module:: django.contrib.gis.utils.ogrinspect
:synopsis: Utilities for inspecting OGR data sources.
:synopsis: Utilities for inspecting OGR data sources.
.. currentmodule:: django.contrib.gis.utils

View File

@ -3,7 +3,7 @@
======================
.. module:: django.contrib.gis.serializers.geojson
:synopsis: Serialization of GeoDjango models in the GeoJSON format.
:synopsis: Serialization of GeoDjango models in the GeoJSON format.
GeoDjango provides a specific serializer for the `GeoJSON`__ format. See
:doc:`/topics/serialization` for more information on serialization.

View File

@ -3,14 +3,14 @@ GeoDjango Utilities
===================
.. module:: django.contrib.gis.utils
:synopsis: GeoDjango's collection of utilities.
:synopsis: GeoDjango's collection of utilities.
The :mod:`django.contrib.gis.utils` module contains various utilities that are
useful in creating geospatial Web applications.
.. toctree::
:maxdepth: 2
:maxdepth: 2
layermapping
ogrinspect
serializers
layermapping
ogrinspect
serializers