Professional Documents
Culture Documents
There are situations where it is not possible or not convenient to use the Upload Form to add
new Layers to GeoNode via the web interface. As an instance:
● The dataset is simply too big to be uploaded through a web interface.
● We would like to import some data from the mass storage programmatically.
● We would like to import some tables from a DataBase.
● We need to process the data first and, maybe, transform it to another format.
This section will walk you through the various options available to load data into your GeoNode
from GeoServer, from the command-line or programmatically.
Management Command importlayers
The geonode.layers Django app includes 2 management commands that you can use to load or
configure data in your GeoNode.
Both of them can be invoked by using the manage.py script.
First of all let’s take a look at the –help option of the importlayers management command in
order to inspect all the command options and features.
Run
1
Uploading data from Computer to server using command line 2020
2
Uploading data from Computer to server using command line 2020
The import layers management command is invoked by specifying options as described above
and specifying the path to a single layer file or to a directory that contains multiple files. For
purposes of this exercise, lets use the default set of testing layers that ship with geonode. You
can replace this path with the directory to your own shapefiles.
NB: Navigate to your project file where you can access the manage.py file and then run the
following command
3
Uploading data from Computer to server using command line 2020
>>> Step 3. Identifying if [trees] is vector or raster and gathering extra files
>>> Step 4. Starting upload of [trees] to GeoServer…
/opt/geonode/geonode/geoserver/helpers.py:1417: FutureWarning: The behavior of this
method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test
instead.
if store:
>>> Step 5. Generating the metadata for [trees] after successful import to GeoSever
>>> Step 6. Making sure [trees] has a valid projection
>>> Step 7. Creating style for [trees]
>>> Step 8. Creating Django record for [trees]
Found geoserver resource for this layer: trees
/home/massoudhamad/.virtualenvs/resilience-academy-geonode/local/lib/python2.7/site-
packages/geoserver/style.py:83: FutureWarning: The behavior of this
method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test
instead.
if not user_style:
/home/massoudhamad/.virtualenvs/resilience-academy-geonode/local/lib/python2.7/site-
packages/geoserver/style.py:87: FutureWarning: The behavior of this method will change in
future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
if user_style:
... Creating Default Resource Links for Layer [geonode:trees]
-- Resource Links[Prune old links]...
-- Resource Links[Prune old links]...done!
-- Resource Links[Compute parameters for the new links]...
-- Resource Links[Create Raw Data download link]...
-- Resource Links[Create Raw Data download link]...done!
-- Resource Links[Set download links for WMS, WCS or WFS and KML]...
-- Resource Links[Set download links for WMS, WCS or WFS and KML]...done!
-- Resource Links[Legend link]...
-- Resource Links[Legend link]...done!
-- Resource Links[Thumbnail link]...
-- Resource Links[Thumbnail link]...done!
-- Resource Links[OWS Links]...
-- Resource Links[OWS Links]...done!
[created] Layer for '/home/massoudhamad/Desktop/FinlandTrip2501-2304/trees/trees.shp'
(1/1)
Detailed report of failures:
Finished processing 1 layers in 3.0 seconds.
1 Created layers
0 Updated layers
0 Skipped layers
0 Failed layers
3.000000 seconds per layer
4
Uploading data from Computer to server using command line 2020
If you encounter errors while running this command, you can use the -v option to increase the
verbosity of the output so you can debug the problem.
The verbosity level can be set from 0-3 with 0 being the default.
Contacts:
resilienceacademytz@gmail.com ,
https://resilienceacademy.ac.tz
https://geonode.resilienceacademy.ac.tz