Kaydet (Commit) 23e1ad53 authored tarafından Sergey Fedoseev's avatar Sergey Fedoseev Kaydeden (comit) Tim Graham

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

üst dbaa1a6b
...@@ -3,67 +3,67 @@ GeoDjango's admin site ...@@ -3,67 +3,67 @@ GeoDjango's admin site
====================== ======================
.. module:: django.contrib.gis.admin .. module:: django.contrib.gis.admin
:synopsis: GeoDjango's extensions to the admin site. :synopsis: GeoDjango's extensions to the admin site.
``GeoModelAdmin`` ``GeoModelAdmin``
================= =================
.. class:: 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. Override the template used to generate the JavaScript slippy map.
Default is ``'gis/admin/openlayers.html'``. 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 Link to the URL of the OpenLayers JavaScript. Defaults to
``'http://openlayers.org/api/2.13.1/OpenLayers.js'``. ``'http://openlayers.org/api/2.13.1/OpenLayers.js'``.
.. attribute:: modifiable .. attribute:: modifiable
Defaults to ``True``. When set to ``False``, disables editing of Defaults to ``True``. When set to ``False``, disables editing of
existing geometry fields in the admin. existing geometry fields in the admin.
.. note:: .. note::
This is different from adding the geometry field to This is different from adding the geometry field to
:attr:`~django.contrib.admin.ModelAdmin.readonly_fields`, :attr:`~django.contrib.admin.ModelAdmin.readonly_fields`,
which will only display the WKT of the geometry. Setting which will only display the WKT of the geometry. Setting
``modifiable=False``, actually displays the geometry in a map, ``modifiable=False``, actually displays the geometry in a map,
but disables the ability to edit its vertices. but disables the ability to edit its vertices.
``OSMGeoAdmin`` ``OSMGeoAdmin``
=============== ===============
.. class:: OSMGeoAdmin .. class:: OSMGeoAdmin
A subclass of :class:`GeoModelAdmin` that uses a spherical mercator projection A subclass of :class:`GeoModelAdmin` that uses a spherical mercator projection
with `OpenStreetMap <https://www.openstreetmap.org/>`_ street data tiles. with `OpenStreetMap <https://www.openstreetmap.org/>`_ street data tiles.
See the :ref:`OSMGeoAdmin introduction <osmgeoadmin-intro>` See the :ref:`OSMGeoAdmin introduction <osmgeoadmin-intro>`
in the tutorial for a usage example. in the tutorial for a usage example.
...@@ -24,59 +24,59 @@ of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`. ...@@ -24,59 +24,59 @@ of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`.
.. django-admin-option:: --blank BLANK .. django-admin-option:: --blank BLANK
Use a comma separated list of OGR field names to add the ``blank=True`` 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 keyword option to the field definition. Set with ``true`` to apply
to all applicable fields. to all applicable fields.
.. django-admin-option:: --decimal DECIMAL .. django-admin-option:: --decimal DECIMAL
Use a comma separated list of OGR float fields to generate Use a comma separated list of OGR float fields to generate
:class:`~django.db.models.DecimalField` instead of the default :class:`~django.db.models.DecimalField` instead of the default
:class:`~django.db.models.FloatField`. Set to ``true`` to apply to all :class:`~django.db.models.FloatField`. Set to ``true`` to apply to all
OGR float fields. OGR float fields.
.. django-admin-option:: --geom-name GEOM_NAME .. django-admin-option:: --geom-name GEOM_NAME
Specifies the model attribute name to use for the geometry field. Specifies the model attribute name to use for the geometry field.
Defaults to ``'geom'``. Defaults to ``'geom'``.
.. django-admin-option:: --layer LAYER_KEY .. django-admin-option:: --layer LAYER_KEY
The key for specifying which layer in the OGR The key for specifying which layer in the OGR
:class:`~django.contrib.gis.gdal.DataSource` source to use. :class:`~django.contrib.gis.gdal.DataSource` source to use.
Defaults to 0 (the first layer). May be an integer or a string identifier 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, for the :class:`~django.contrib.gis.gdal.Layer`. When inspecting databases,
``layer`` is generally the table name you want to inspect. ``layer`` is generally the table name you want to inspect.
.. django-admin-option:: --mapping .. django-admin-option:: --mapping
Automatically generate a mapping dictionary for use with Automatically generate a mapping dictionary for use with
:class:`~django.contrib.gis.utils.LayerMapping`. :class:`~django.contrib.gis.utils.LayerMapping`.
.. django-admin-option:: --multi-geom .. django-admin-option:: --multi-geom
When generating the geometry field, treat it as a geometry collection. When generating the geometry field, treat it as a geometry collection.
For example, if this setting is enabled then a For example, if this setting is enabled then a
:class:`~django.contrib.gis.db.models.MultiPolygonField` will be placed :class:`~django.contrib.gis.db.models.MultiPolygonField` will be placed
in the generated model rather than in the generated model rather than
:class:`~django.contrib.gis.db.models.PolygonField`. :class:`~django.contrib.gis.db.models.PolygonField`.
.. django-admin-option:: --name-field NAME_FIELD .. django-admin-option:: --name-field NAME_FIELD
Generates a ``__str__`` routine (``__unicode__`` on Python 2) on the model Generates a ``__str__`` routine (``__unicode__`` on Python 2) on the model
that will return the given field name. that will return the given field name.
.. django-admin-option:: --no-imports .. 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 .. django-admin-option:: --null NULL
Use a comma separated list of OGR field names to add the ``null=True`` 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 keyword option to the field definition. Set with ``true`` to apply to
all applicable fields. all applicable fields.
.. django-admin-option:: --srid SRID .. django-admin-option:: --srid SRID
The SRID to use for the geometry field. If not set, ``ogrinspect`` attempts The SRID to use for the geometry field. If not set, ``ogrinspect`` attempts
to automatically determine of the SRID of the data source. to automatically determine of the SRID of the data source.
...@@ -8,7 +8,7 @@ Spatial Backends ...@@ -8,7 +8,7 @@ Spatial Backends
================ ================
.. module:: django.contrib.gis.db.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: GeoDjango currently provides the following spatial database backends:
...@@ -18,7 +18,7 @@ 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`` * ``django.contrib.gis.db.backends.spatialite``
.. module:: django.contrib.gis.db.models .. module:: django.contrib.gis.db.models
:synopsis: GeoDjango's database API. :synopsis: GeoDjango's database API.
.. _mysql-spatial-limitations: .. _mysql-spatial-limitations:
...@@ -297,7 +297,7 @@ Database functions ...@@ -297,7 +297,7 @@ Database functions
------------------ ------------------
.. module:: django.contrib.gis.db.models.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 The following table provides a summary of what geography-specific database
functions are available on each spatial backend. functions are available on each spatial backend.
...@@ -360,9 +360,9 @@ Aggregate PostGIS Oracle SpatiaLite ...@@ -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>`_ .. [#fnmysqlidx] *See* `Creating Spatial Indexes <https://dev.mysql.com/doc/refman/5.6/en/creating-spatial-indexes.html>`_
in the MySQL Reference Manual: in the MySQL Reference Manual:
For MyISAM tables, ``SPATIAL INDEX`` creates an R-tree index. For storage For MyISAM tables, ``SPATIAL INDEX`` creates an R-tree index. For storage
engines that support nonspatial indexing of spatial columns, the engine 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 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 exact-value lookups, but not for range scans.
.. [#] Refer :ref:`mysql-spatial-limitations` section for more details. .. [#] Refer :ref:`mysql-spatial-limitations` section for more details.
...@@ -3,7 +3,7 @@ Geographic Feeds ...@@ -3,7 +3,7 @@ Geographic Feeds
================ ================
.. module:: django.contrib.gis.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 GeoDjango has its own :class:`Feed` subclass that may embed location information
in RSS/Atom feeds formatted according to either the `Simple GeoRSS`__ or in RSS/Atom feeds formatted according to either the `Simple GeoRSS`__ or
...@@ -26,10 +26,10 @@ API Reference ...@@ -26,10 +26,10 @@ API Reference
.. class:: Feed .. class:: Feed
In addition to methods provided by In addition to methods provided by the
the :class:`django.contrib.syndication.views.Feed` :class:`django.contrib.syndication.views.Feed` base class, GeoDjango's
base class, GeoDjango's ``Feed`` class provides ``Feed`` class provides the following overrides. Note that these overrides
the following overrides. Note that these overrides may be done in multiple ways:: may be done in multiple ways::
from django.contrib.gis.feeds import Feed from django.contrib.gis.feeds import Feed
...@@ -53,23 +53,23 @@ API Reference ...@@ -53,23 +53,23 @@ API Reference
def item_geometry(self, item): def item_geometry(self, item):
... ...
.. method:: geometry(obj) .. method:: geometry(obj)
Takes the object returned by ``get_object()`` and returns the *feed's* Takes the object returned by ``get_object()`` and returns the *feed's*
geometry. Typically this is a ``GEOSGeometry`` instance, or can be a geometry. Typically this is a ``GEOSGeometry`` instance, or can be a tuple
tuple to represent a point or a box. For example:: to represent a point or a box. For example::
class ZipcodeFeed(Feed): class ZipcodeFeed(Feed):
def geometry(self, obj): def geometry(self, obj):
# Can also return: `obj.poly`, and `obj.poly.centroid`. # Can also return: `obj.poly`, and `obj.poly.centroid`.
return obj.poly.extent # tuple like: (X0, Y0, X1, Y1). 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 Set this to return the geometry for each *item* in the feed. This can be a
can be a ``GEOSGeometry`` instance, or a tuple that represents a ``GEOSGeometry`` instance, or a tuple that represents a point coordinate or
point coordinate or bounding box. For example:: bounding box. For example::
class ZipcodeFeed(Feed): class ZipcodeFeed(Feed):
......
...@@ -3,7 +3,7 @@ GeoDjango Forms API ...@@ -3,7 +3,7 @@ GeoDjango Forms API
=================== ===================
.. module:: django.contrib.gis.forms .. 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 GeoDjango provides some specialized form fields and widgets in order to visually
display and edit geolocalized data on a map. By default, they use display and edit geolocalized data on a map. By default, they use
...@@ -83,7 +83,7 @@ Form widgets ...@@ -83,7 +83,7 @@ Form widgets
============ ============
.. module:: django.contrib.gis.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 GeoDjango form widgets allow you to display and edit geographic data on a
visual map. visual map.
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ Geolocation with GeoIP ...@@ -3,7 +3,7 @@ Geolocation with GeoIP
====================== ======================
.. module:: django.contrib.gis.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 .. deprecated:: 1.9
...@@ -33,27 +33,27 @@ Example ...@@ -33,27 +33,27 @@ Example
Assuming you have the GeoIP C library installed, here is an example of its Assuming you have the GeoIP C library installed, here is an example of its
usage:: usage::
>>> from django.contrib.gis.geoip import GeoIP >>> from django.contrib.gis.geoip import GeoIP
>>> g = GeoIP() >>> g = GeoIP()
>>> g.country('google.com') >>> g.country('google.com')
{'country_code': 'US', 'country_name': 'United States'} {'country_code': 'US', 'country_name': 'United States'}
>>> g.city('72.14.207.99') >>> g.city('72.14.207.99')
{'area_code': 650, {'area_code': 650,
'city': 'Mountain View', 'city': 'Mountain View',
'country_code': 'US', 'country_code': 'US',
'country_code3': 'USA', 'country_code3': 'USA',
'country_name': 'United States', 'country_name': 'United States',
'dma_code': 807, 'dma_code': 807,
'latitude': 37.419200897216797, 'latitude': 37.419200897216797,
'longitude': -122.05740356445312, 'longitude': -122.05740356445312,
'postal_code': '94043', 'postal_code': '94043',
'region': 'CA'} 'region': 'CA'}
>>> g.lat_lon('salon.com') >>> g.lat_lon('salon.com')
(37.789798736572266, -122.39420318603516) (37.789798736572266, -122.39420318603516)
>>> g.lon_lat('uh.edu') >>> g.lon_lat('uh.edu')
(-95.415199279785156, 29.77549934387207) (-95.415199279785156, 29.77549934387207)
>>> g.geos('24.124.1.80').wkt >>> g.geos('24.124.1.80').wkt
'POINT (-95.2087020874023438 39.0392990112304688)' 'POINT (-95.2087020874023438 39.0392990112304688)'
``GeoIP`` Settings ``GeoIP`` Settings
================== ==================
......
...@@ -3,7 +3,7 @@ Geolocation with GeoIP2 ...@@ -3,7 +3,7 @@ Geolocation with GeoIP2
======================= =======================
.. module:: django.contrib.gis.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 .. versionadded:: 1.9
...@@ -29,25 +29,25 @@ Example ...@@ -29,25 +29,25 @@ Example
Here is an example of its usage:: Here is an example of its usage::
>>> from django.contrib.gis.geoip2 import GeoIP2 >>> from django.contrib.gis.geoip2 import GeoIP2
>>> g = GeoIP2() >>> g = GeoIP2()
>>> g.country('google.com') >>> g.country('google.com')
{'country_code': 'US', 'country_name': 'United States'} {'country_code': 'US', 'country_name': 'United States'}
>>> g.city('72.14.207.99') >>> g.city('72.14.207.99')
{'city': 'Mountain View', {'city': 'Mountain View',
'country_code': 'US', 'country_code': 'US',
'country_name': 'United States', 'country_name': 'United States',
'dma_code': 807, 'dma_code': 807,
'latitude': 37.419200897216797, 'latitude': 37.419200897216797,
'longitude': -122.05740356445312, 'longitude': -122.05740356445312,
'postal_code': '94043', 'postal_code': '94043',
'region': 'CA'} 'region': 'CA'}
>>> g.lat_lon('salon.com') >>> g.lat_lon('salon.com')
(39.0437, -77.4875) (39.0437, -77.4875)
>>> g.lon_lat('uh.edu') >>> g.lon_lat('uh.edu')
(-95.4342, 29.834) (-95.4342, 29.834)
>>> g.geos('24.124.1.80').wkt >>> g.geos('24.124.1.80').wkt
'POINT (-97.0000000000000000 38.0000000000000000)' 'POINT (-97.0000000000000000 38.0000000000000000)'
``GeoIP`` Settings ``GeoIP`` Settings
================== ==================
......
...@@ -1308,9 +1308,9 @@ Returns a ``LineString`` constructed from the point field geometries in the ...@@ -1308,9 +1308,9 @@ Returns a ``LineString`` constructed from the point field geometries in the
Example:: Example::
>>> print(City.objects.filter(name__in=('Houston', 'Dallas') >>> qs = City.objects.filter(name__in=('Houston', 'Dallas')).aggregate(MakeLine('poly'))
... ).aggregate(MakeLine('poly'))['poly__makeline'] >>> print(qs['poly__makeline'])
LINESTRING (-95.3631510000000020 29.7633739999999989, -96.8016109999999941 32.7820570000000018) LINESTRING (-95.3631510000000020 29.7633739999999989, -96.8016109999999941 32.7820570000000018)
``Union`` ``Union``
~~~~~~~~~ ~~~~~~~~~
......
This diff is collapsed.
...@@ -3,31 +3,31 @@ GeoDjango ...@@ -3,31 +3,31 @@ GeoDjango
========= =========
.. module:: django.contrib.gis .. 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 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 make it as easy as possible to build GIS Web applications and harness the power
of spatially enabled data. of spatially enabled data.
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
tutorial tutorial
install/index install/index
model-api model-api
db-api db-api
forms-api forms-api
geoquerysets geoquerysets
functions functions
measure measure
geos geos
gdal gdal
geoip geoip
geoip2 geoip2
utils utils
commands commands
admin admin
feeds feeds
sitemaps sitemaps
testing testing
deployment deployment
...@@ -82,11 +82,11 @@ is required. ...@@ -82,11 +82,11 @@ is required.
.. note:: .. note::
On Linux platforms, it may be necessary to run the ``ldconfig`` On Linux platforms, it may be necessary to run the ``ldconfig`` command
command after installing each library. For example:: after installing each library. For example::
$ sudo make install $ sudo make install
$ sudo ldconfig $ sudo ldconfig
.. note:: .. note::
...@@ -210,10 +210,10 @@ Configure, make and install:: ...@@ -210,10 +210,10 @@ Configure, make and install::
.. note:: .. note::
Because GeoDjango has its own Python interface, the preceding instructions Because GeoDjango has its own Python interface, the preceding instructions
do not build GDAL's own Python bindings. The bindings may be built by do not build GDAL's own Python bindings. The bindings may be built by
adding the ``--with-python`` flag when running ``configure``. See adding the ``--with-python`` flag when running ``configure``. See
`GDAL/OGR In Python`__ for more information on GDAL's bindings. `GDAL/OGR In Python`__ for more information on GDAL's bindings.
If you have any problems, please see the troubleshooting section below for If you have any problems, please see the troubleshooting section below for
suggestions and solutions. suggestions and solutions.
...@@ -253,7 +253,6 @@ the GDAL library. For example:: ...@@ -253,7 +253,6 @@ the GDAL library. For example::
GDAL_LIBRARY_PATH = '/home/sue/local/lib/libgdal.so' GDAL_LIBRARY_PATH = '/home/sue/local/lib/libgdal.so'
.. rubric:: Footnotes .. rubric:: Footnotes
.. [#] The datum shifting files are needed for converting data to and from .. [#] The datum shifting files are needed for converting data to and from
certain projections. certain projections.
......
...@@ -76,18 +76,18 @@ Geospatial libraries ...@@ -76,18 +76,18 @@ Geospatial libraries
-------------------- --------------------
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
geolibs geolibs
Database installation Database installation
--------------------- ---------------------
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
postgis postgis
spatialite spatialite
Add ``django.contrib.gis`` to :setting:`INSTALLED_APPS` Add ``django.contrib.gis`` to :setting:`INSTALLED_APPS`
------------------------------------------------------- -------------------------------------------------------
...@@ -480,14 +480,14 @@ executable with ``cmd.exe``, will set this up: ...@@ -480,14 +480,14 @@ executable with ``cmd.exe``, will set this up:
.. code-block:: bat .. code-block:: bat
set OSGEO4W_ROOT=C:\OSGeo4W set OSGEO4W_ROOT=C:\OSGeo4W
set PYTHON_ROOT=C:\Python27 set PYTHON_ROOT=C:\Python27
set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal set GDAL_DATA=%OSGEO4W_ROOT%\share\gdal
set PROJ_LIB=%OSGEO4W_ROOT%\share\proj set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
set PATH=%PATH%;%PYTHON_ROOT%;%OSGEO4W_ROOT%\bin 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 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 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%" 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 For your convenience, these commands are available in the executable batch
script, :download:`geodjango_setup.bat`. script, :download:`geodjango_setup.bat`.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
==================================== ====================================
.. module:: django.contrib.gis.utils.layermapping .. 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 .. currentmodule:: django.contrib.gis.utils
......
...@@ -3,7 +3,7 @@ Measurement Objects ...@@ -3,7 +3,7 @@ Measurement Objects
=================== ===================
.. module:: django.contrib.gis.measure .. 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 The :mod:`django.contrib.gis.measure` module contains objects that allow
for convenient representation of distance and area units of measure. [#]_ for convenient representation of distance and area units of measure. [#]_
...@@ -113,64 +113,64 @@ Measurement API ...@@ -113,64 +113,64 @@ Measurement API
.. class:: Distance(**kwargs) .. class:: Distance(**kwargs)
To initialize a distance object, pass in a keyword corresponding to To initialize a distance object, pass in a keyword corresponding to the
the desired :ref:`unit attribute name <supported_units>` set with desired :ref:`unit attribute name <supported_units>` set with desired
desired value. For example, the following creates a distance value. For example, the following creates a distance object representing 5
object representing 5 miles:: 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 Returns the distance value in units corresponding to the given unit
attribute. For example:: attribute. For example::
>>> print(dist.km) >>> print(dist.km)
8.04672 8.04672
.. classmethod:: unit_attname(unit_name) .. classmethod:: unit_attname(unit_name)
Returns the distance unit attribute name for the given full unit name. Returns the distance unit attribute name for the given full unit name. For
For example:: example::
>>> Distance.unit_attname('Mile') >>> Distance.unit_attname('Mile')
'mi' 'mi'
.. class:: D .. class:: D
Alias for :class:`Distance` class. Alias for :class:`Distance` class.
``Area`` ``Area``
-------- --------
.. class:: Area(**kwargs) .. class:: Area(**kwargs)
To initialize an area object, pass in a keyword corresponding to To initialize an area object, pass in a keyword corresponding to the
the desired :ref:`unit attribute name <supported_units>` set with desired :ref:`unit attribute name <supported_units>` set with desired
desired value. For example, the following creates an area value. For example, the following creates an area object representing 5
object representing 5 square miles:: 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 Returns the area value in units corresponding to the given unit attribute.
attribute. For example:: For example::
>>> print(a.sq_km) >>> print(a.sq_km)
12.949940551680001 12.949940551680001
.. classmethod:: unit_attname(unit_name) .. classmethod:: unit_attname(unit_name)
Returns the area unit attribute name for the given full unit name. Returns the area unit attribute name for the given full unit name. For
For example:: example::
>>> Area.unit_attname('Kilometer') >>> Area.unit_attname('Kilometer')
'sq_km' 'sq_km'
.. class:: A .. class:: A
Alias for :class:`Area` class. Alias for :class:`Area` class.
.. rubric:: Footnotes .. rubric:: Footnotes
.. [#] `Robert Coup <https://koordinates.com/>`_ is the initial author of the measure objects, .. [#] `Robert Coup <https://koordinates.com/>`_ is the initial author of the measure objects,
......
...@@ -3,7 +3,7 @@ GeoDjango Model API ...@@ -3,7 +3,7 @@ GeoDjango Model API
=================== ===================
.. module:: django.contrib.gis.db.models .. 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 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 section, we'll be using the following geographic model of a `ZIP code`__ and
......
...@@ -3,7 +3,7 @@ OGR Inspection ...@@ -3,7 +3,7 @@ OGR Inspection
============== ==============
.. module:: django.contrib.gis.utils.ogrinspect .. 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 .. currentmodule:: django.contrib.gis.utils
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
====================== ======================
.. module:: django.contrib.gis.serializers.geojson .. 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 GeoDjango provides a specific serializer for the `GeoJSON`__ format. See
:doc:`/topics/serialization` for more information on serialization. :doc:`/topics/serialization` for more information on serialization.
......
...@@ -3,14 +3,14 @@ GeoDjango Utilities ...@@ -3,14 +3,14 @@ GeoDjango Utilities
=================== ===================
.. module:: django.contrib.gis.utils .. 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 The :mod:`django.contrib.gis.utils` module contains various utilities that are
useful in creating geospatial Web applications. useful in creating geospatial Web applications.
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
layermapping layermapping
ogrinspect ogrinspect
serializers serializers
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment