mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #34140 -- Corrected rst code-block and various formatting issues in docs.
This commit is contained in:
committed by
Mariusz Felisiak
parent
c67ea79aa9
commit
ba755ca131
@@ -139,7 +139,7 @@ Geometry Lookups
|
||||
Geographic queries with geometries take the following general form (assuming
|
||||
the ``Zipcode`` model used in the :doc:`model-api`):
|
||||
|
||||
.. code-block:: pycon
|
||||
.. code-block:: text
|
||||
|
||||
>>> qs = Zipcode.objects.filter(<field>__<lookup_type>=<parameter>)
|
||||
>>> qs = Zipcode.objects.exclude(...)
|
||||
@@ -175,7 +175,7 @@ band index can be specified.
|
||||
This results in the following general form for lookups involving rasters
|
||||
(assuming the ``Elevation`` model used in the :doc:`model-api`):
|
||||
|
||||
.. code-block:: pycon
|
||||
.. code-block:: text
|
||||
|
||||
>>> qs = Elevation.objects.filter(<field>__<lookup_type>=<parameter>)
|
||||
>>> qs = Elevation.objects.filter(<field>__<band_index>__<lookup_type>=<parameter>)
|
||||
|
||||
@@ -1007,15 +1007,15 @@ Coordinate System Objects
|
||||
>>> proj = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs '
|
||||
>>> wgs84 = SpatialReference(proj) # PROJ string
|
||||
>>> wgs84 = SpatialReference("""GEOGCS["WGS 84",
|
||||
DATUM["WGS_1984",
|
||||
SPHEROID["WGS 84",6378137,298.257223563,
|
||||
AUTHORITY["EPSG","7030"]],
|
||||
AUTHORITY["EPSG","6326"]],
|
||||
PRIMEM["Greenwich",0,
|
||||
AUTHORITY["EPSG","8901"]],
|
||||
UNIT["degree",0.01745329251994328,
|
||||
AUTHORITY["EPSG","9122"]],
|
||||
AUTHORITY["EPSG","4326"]]""") # OGC WKT
|
||||
... DATUM["WGS_1984",
|
||||
... SPHEROID["WGS 84",6378137,298.257223563,
|
||||
... AUTHORITY["EPSG","7030"]],
|
||||
... AUTHORITY["EPSG","6326"]],
|
||||
... PRIMEM["Greenwich",0,
|
||||
... AUTHORITY["EPSG","8901"]],
|
||||
... UNIT["degree",0.01745329251994328,
|
||||
... AUTHORITY["EPSG","9122"]],
|
||||
... AUTHORITY["EPSG","4326"]]""") # OGC WKT
|
||||
|
||||
.. method:: __getitem__(target)
|
||||
|
||||
@@ -1025,7 +1025,7 @@ Coordinate System Objects
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
|
||||
>>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]'
|
||||
>>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326
|
||||
>>> print(srs['GEOGCS'])
|
||||
WGS 84
|
||||
|
||||
@@ -702,11 +702,13 @@ Distance Lookups
|
||||
For an overview on performing distance queries, please refer to
|
||||
the :ref:`distance queries introduction <distance-queries>`.
|
||||
|
||||
Distance lookups take the following form::
|
||||
Distance lookups take the following form:
|
||||
|
||||
<field>__<distance lookup>=(<geometry/raster>, <distance value>[, 'spheroid'])
|
||||
<field>__<distance lookup>=(<raster>, <band_index>, <distance value>[, 'spheroid'])
|
||||
<field>__<band_index>__<distance lookup>=(<raster>, <band_index>, <distance value>[, 'spheroid'])
|
||||
.. code-block:: text
|
||||
|
||||
<field>__<distance lookup>=(<geometry/raster>, <distance value>[, "spheroid"])
|
||||
<field>__<distance lookup>=(<raster>, <band_index>, <distance value>[, "spheroid"])
|
||||
<field>__<band_index>__<distance lookup>=(<raster>, <band_index>, <distance value>[, "spheroid"])
|
||||
|
||||
The value passed into a distance lookup is a tuple; the first two
|
||||
values are mandatory, and are the geometry to calculate distances to,
|
||||
|
||||
@@ -822,7 +822,7 @@ Other Properties & Methods
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> if poly_1.area > poly_2.area:
|
||||
>>> pass
|
||||
... pass
|
||||
|
||||
.. _geos-geometry-collections:
|
||||
|
||||
|
||||
@@ -70,9 +70,10 @@ Example
|
||||
|
||||
>>> from django.contrib.gis.utils import LayerMapping
|
||||
>>> from geoapp.models import TestGeo
|
||||
>>> mapping = {'name' : 'str', # The 'name' model field maps to the 'str' layer field.
|
||||
'poly' : 'POLYGON', # For geometry fields use OGC name.
|
||||
} # The mapping is a dictionary
|
||||
>>> mapping = {
|
||||
... 'name': 'str', # The 'name' model field maps to the 'str' layer field.
|
||||
... 'poly': 'POLYGON', # For geometry fields use OGC name.
|
||||
... } # The mapping is a dictionary
|
||||
>>> lm = LayerMapping(TestGeo, 'test_poly.shp', mapping)
|
||||
>>> lm.save(verbose=True) # Save the layermap, imports the data.
|
||||
Saved: Name: 1
|
||||
|
||||
Reference in New Issue
Block a user