Management Commands for GeoNode¶
GeoNode comes with administrative commands to help with day to day tasks.
Below is the list of the ones that come from the GeoNode application, the full list can be obtained by doing:
python manage.py help
importlayers¶
Imports a file or folder with geospatial files to GeoNode.
It supports data in Shapefile and GeoTIFF format. It also picks up the styles if a .sld
file is present.
Usage:
python manage.py importlayers <data_dir>
Additional options:
Usage: manage.py importlayers [options] path [path...]
Brings a data file or a directory full of data files into a GeoNode site. Layers are added to the Django database, the GeoServer configuration, and the GeoNetwork metadata index.
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on exception
-u USER, --user=USER Name of the user account which should own the imported
layers
-i, --ignore-errors Stop after any errors are encountered.
-o, --overwrite Overwrite existing layers if discovered (defaults
False)
-k KEYWORDS, --keywords=KEYWORDS
The default keywords, separated by comma, for the
imported layer(s). Will be the same for all imported
layers if multiple imports are
done in one command
-c CATEGORY, --category=CATEGORY
The category for the imported
layer(s). Will be the same for all imported layers
if multiple imports are done in one command
-r REGIONS, --regions=REGIONS
The default regions, separated by comma, for the
imported layer(s). Will be the same for all imported
layers if multiple imports are
done in one command
-t TITLE, --title=TITLE
The title for the imported
layer(s). Will be the same for all imported layers
if multiple imports are done in one command
-p, --private Make layer viewable only to owner
--version show program's version number and exit
-h, --help show this help message and exit
updatelayers¶
Update the GeoNode application with data from GeoServer.
This is useful to add data in formats that are not supported in GeoNode by default, and for example to link it it to ArcSDE datastores. The updatelayers command provides several options that can be used to control how layer information is read from GeoServer and updated in GeoNode. Refer to ‘Additional Options’.
Usage:
python manage.py updatelayers
Additional options:
Usage: manage.py updatelayers [options]
Update the GeoNode application with data from GeoServer
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on exception
-i, --ignore-errors Stop after any errors are encountered.
--skip-unadvertised Skip processing unadvertised layers from GeoSever.
--skip-geonode-registered
Just processing GeoServer layers still not registered
in GeoNode.
--remove-deleted Remove GeoNode layers that have been deleted from
GeoSever.
-u USER, --user=USER Name of the user account which should own the imported
layers
-f FILTER, --filter=FILTER
Only update data the layers that match the given
filter
-s STORE, --store=STORE
Only update data the layers for the given geoserver
store name
-w WORKSPACE, --workspace=WORKSPACE
Only update data on specified workspace
--version show program's version number and exit
-h, --help show this help message and exit
createvectorlayer¶
Create an empty PostGIS vector layer in GeoNode.
Usage:
python manage.py createvectorlayer name [options]
Additional options:
manage.py createvectorlayer [-h] [--version] [-v {0,1,2,3}]
[--settings SETTINGS]
[--pythonpath PYTHONPATH] [--traceback]
[--no-color] [--user USER]
[--geometry GEOMETRY]
[--attributes ATTRIBUTES] [--title TITLE]
name
Create an empty PostGIS vector layer in GeoNode.
positional arguments:
name
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-v {0,1,2,3}, --verbosity {0,1,2,3}
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on CommandError exceptions
--no-color Don't colorize the command output.
--user USER Name of the user account which should own the created
layer
--geometry GEOMETRY Geometry type of the layer to be created. Can be
Point, LineString or Polygon. Default is Point
--attributes ATTRIBUTES
A json representation of the attributes to create.
Example: { "field_str": "string", "field_int":
"integer", "field_date": "date", "field_float":
"float"}
--title TITLE Title for the layer to be created.
fixsitename¶
Uses SITENAME and SITEURL to set the values of the default site object.
This information is used in the page titles and when sending emails from GeoNode, for example, new registrations.
Usage:
python manage.py fixsitename
Additional options:
Usage: manage.py fixsitename [options]
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on exception
--version show program's version number and exit
-h, --help show this help message and exit
delete_orphaned_files¶
Deletes orphaned files of deleted documents.
Usage:
python manage.py delete_orphaned_files
delete_orphaned_thumbs¶
Deletes orphaned thumbnails of deleted GeoNode resources (Layers, Maps and Documents).
Usage:
python manage.py delete_orphaned_thumbs
fix_baselayers¶
Fix base layers for all of the GeoNode maps or for a given map.
Usage:
# fix base layers for all of the GeoNode map
python manage.py fix_baselayers
# fix base layers for a given map
python manage.py fix_baselayers map_id
sync_geofence¶
Synchronize GeoNode permissions in GeoFence. This can be useful when upgrading GeoNode.
Usage:
# synchronize all layers
python manage.py sync_geofence
# synchronize all layers which contain a given search string in their name
python manage.py sync_geofence --layername cambridge
find_geoserver_broken_layers¶
Find GeoNode layers with a missing GeoServer resource.
Usage:
# search the whole catalog
python manage.py find_geoserver_broken_layers
# search all layers which contain a given search string in their name and owned by a given user
python manage.py sync_geofence --layername cambridge --owner bob
# remove layers which are broken
python manage.py find_geoserver_broken_layers --remove