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