Commit 459c71e3 authored by Justin Bronn's avatar Justin Bronn
Browse files

Fixed #12930, #12832, #11538 -- Refactored and merged the GeoDjango...

Fixed #12930, #12832, #11538 -- Refactored and merged the GeoDjango documentation into the rest of the Django docs.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@12856 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 667ced2a
Loading
Loading
Loading
Loading
+57 −0
Original line number Diff line number Diff line
.. _ref-gis-admin:

======================
GeoDjango's admin site
======================

.. module:: django.contrib.gis.admin
   :synopsis: GeoDjango's extensions to the admin site.


``GeoModelAdmin``
=================

.. class:: GeoModelAdmin

   .. attribute:: default_lon

   The default center longitude.

   .. attribute:: default_lat

   The default center latitude.

   .. attribute:: default_zoom

   The default zoom level to use.  Defaults to 18.

   .. attribute:: extra_js

   Sequence of URLs to any extra JavaScript to include.

   .. attribute:: map_template

   Override the template used to generate the JavaScript slippy map.
   Default is ``'gis/admin/openlayers.html'``.

   .. attribute:: map_width

   Width of the map, in pixels.  Defaults to 600.

   .. attribute:: map_height

   Height of the map, in pixels.  Defaults to 400.

   .. attribute:: openlayers_url

   Link to the URL of the OpenLayers JavaScript.  Defaults to
   ``'http://openlayers.org/api/2.8/OpenLayers.js'``.

``OSMGeoAdmin``
===============

.. class:: OSMGeoAdmin

   A subclass of :class:`GeoModelAdmin` that uses a spherical mercator projection
   with OpenStreetMap street data tiles.  See the :ref:`OSMGeoAdmin introduction <osmgeoadmin-intro>`
   in the tutorial for a usage example.
+83 −0
Original line number Diff line number Diff line
.. ref-geodjango-admin:

=============================
GeoDjango Management Commands
=============================

inspectdb
=========

.. describe:: django-admin.py inspectdb

When :mod:`django.contrib.gis` is in your :setting:`INSTALLED_APPS`, the
:djadmin:`inspectdb` management command is overridden with one from GeoDjango.
The overridden command is spatially-aware, and places geometry fields in the
auto-generated model definition, where appropriate.

ogrinspect <data_source> <model_name>
=====================================

.. django-admin:: ogrinspect

The ``ogrinpsect`` management command will inspect the given OGR-compatible
:class:`~django.contrib.gis.gdal.DataSource` (e.g., a shapefile) and will
output a GeoDjango model with the given model name.  There's a detailed example
of using ``ogrinspect`` :ref:`in the tutorial <ogrinspect-intro>`.

.. django-admin-option:: --blank <blank_field(s)>

   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_field(s)>

   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 <name>

   Specifies the model attribute name to use for the geometry field.
   Defaults to ``'geom'``.

.. django-admin-option:: --layer <layer>

   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`.

.. django-admin-option:: --mapping

   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`.

.. django-admin-option:: --name-field <name_field>

   Generates a ``__unicode__`` routine on the model that will return the
   the given field name.

.. django-admin-option:: --no-imports

   Suppresses the ``from django.contrib.gis.db import models`` import statement.

.. django-admin-option:: --null <null_field(s)>

   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
   
   The SRID to use for the geometry field.  If not set, ``ogrinspect`` attempts
   to automatically determine of the SRID of the data source.
+9 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash
POSTGIS_SQL_PATH=`pg_config --sharedir`
createdb -E UTF8 template_postgis # Create the template spatial database.
createlang -d template_postgis plpgsql # Adding PLPGSQL language support.
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
psql -d template_postgis -f $POSTGIS_SQL_PATH/lwpostgis.sql # Loading the PostGIS SQL routines
psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables.
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
+9 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash
POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.4
createdb -E UTF8 template_postgis # Create the template spatial database.
createlang -d template_postgis plpgsql # Adding PLPGSQL language support.
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql # Loading the PostGIS SQL routines
psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables.
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
+9 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash
POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5
createdb -E UTF8 template_postgis # Create the template spatial database.
createlang -d template_postgis plpgsql # Adding PLPGSQL language support.
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql # Loading the PostGIS SQL routines
psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables.
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
Loading