diff options
| author | Sean Wang <sean@decrypted.org> | 2015-02-18 19:19:21 -0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-22 09:35:39 -0500 |
| commit | eba6dff581aa8bd6a1c08456e83e68ad09ae4ec3 (patch) | |
| tree | ab96fd1185101181e572d72ed40deb93b7ff2d60 /docs/ref/contrib/gis/tutorial.txt | |
| parent | ea3168dc6ced391d848c511a14cfcecfeac9d401 (diff) | |
Fixed #24358 -- Corrected code-block directives for console sessions.
Diffstat (limited to 'docs/ref/contrib/gis/tutorial.txt')
| -rw-r--r-- | docs/ref/contrib/gis/tutorial.txt | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt index 05f3c8360b..c93e55ec69 100644 --- a/docs/ref/contrib/gis/tutorial.txt +++ b/docs/ref/contrib/gis/tutorial.txt @@ -56,7 +56,7 @@ First, create a spatial database for your project. If you are using PostGIS, create the database from the :ref:`spatial database template <spatialdb_template>`: -.. code-block:: bash +.. code-block:: console $ createdb -T template_postgis geodjango @@ -66,7 +66,7 @@ template <spatialdb_template>`: create a database. To create a user with ``CREATE DATABASE`` privileges in PostgreSQL, use the following commands: - .. code-block:: bash + .. code-block:: console $ sudo su - postgres $ createuser --createdb geo @@ -84,14 +84,14 @@ Create a New Project Use the standard ``django-admin`` script to create a project called ``geodjango``: -.. code-block:: bash +.. code-block:: console $ django-admin startproject geodjango This will initialize a new project. Now, create a ``world`` Django application within the ``geodjango`` project: -.. code-block:: bash +.. code-block:: console $ cd geodjango $ python manage.py startapp world @@ -137,7 +137,7 @@ The world borders data is available in this `zip file`__. Create a ``data`` directory in the ``world`` application, download the world borders data, and unzip. On GNU/Linux platforms, use the following commands: -.. code-block:: bash +.. code-block:: console $ mkdir world/data $ cd world/data @@ -166,7 +166,7 @@ Use ``ogrinfo`` to examine spatial data The GDAL ``ogrinfo`` utility allows examining the metadata of shapefiles or other vector data sources: -.. code-block:: bash +.. code-block:: console $ ogrinfo world/data/TM_WORLD_BORDERS-0.3.shp INFO: Open of `world/data/TM_WORLD_BORDERS-0.3.shp' @@ -177,7 +177,7 @@ other vector data sources: layer contains polygon data. To find out more, we'll specify the layer name and use the ``-so`` option to get only the important summary information: -.. code-block:: bash +.. code-block:: console $ ogrinfo -so world/data/TM_WORLD_BORDERS-0.3.shp TM_WORLD_BORDERS-0.3 INFO: Open of `world/data/TM_WORLD_BORDERS-0.3.shp' @@ -267,7 +267,7 @@ Run ``migrate`` After defining your model, you need to sync it with the database. First, create a database migration: -.. code-block:: bash +.. code-block:: console $ python manage.py makemigrations Migrations for 'world': @@ -277,7 +277,7 @@ create a database migration: Let's look at the SQL that will generate the table for the ``WorldBorder`` model: -.. code-block:: bash +.. code-block:: console $ python manage.py sqlmigrate world 0001 @@ -314,7 +314,7 @@ This command should produce the following output: If this looks correct, run :djadmin:`migrate` to create this table in the database: -.. code-block:: bash +.. code-block:: console $ python manage.py migrate Operations to perform: @@ -351,7 +351,7 @@ library that can work with all the vector data sources that OGR supports. First, invoke the Django shell: -.. code-block:: bash +.. code-block:: console $ python manage.py shell @@ -515,7 +515,7 @@ A few notes about what's going on: Afterwards, invoke the Django shell from the ``geodjango`` project directory: -.. code-block:: bash +.. code-block:: console $ python manage.py shell @@ -537,7 +537,7 @@ and generates a model definition and ``LayerMapping`` dictionary automatically. The general usage of the command goes as follows: -.. code-block:: bash +.. code-block:: console $ python manage.py ogrinspect [options] <data_source> <model_name> [options] @@ -548,7 +548,7 @@ be used to further define how the model is generated. For example, the following command nearly reproduces the ``WorldBorder`` model and mapping dictionary created above, automatically: -.. code-block:: bash +.. code-block:: console $ python manage.py ogrinspect world/data/TM_WORLD_BORDERS-0.3.shp WorldBorder \ --srid=4326 --mapping --multi @@ -609,7 +609,7 @@ GeoDjango adds spatial lookups to the Django ORM. For example, you can find the country in the ``WorldBorder`` table that contains a particular point. First, fire up the management shell: -.. code-block:: bash +.. code-block:: console $ python manage.py shell @@ -753,13 +753,13 @@ Next, edit your ``urls.py`` in the ``geodjango`` application folder as follows:: Create an admin user: -.. code-block:: bash +.. code-block:: console $ python manage.py createsuperuser Next, start up the Django development server: -.. code-block:: bash +.. code-block:: console $ python manage.py runserver |
