geonode.geoserver.helpers
Attributes
Classes
Functions
Verifies all geoserver is running, |
|
|
Wrap an XML snippet representing a single symbolizer in the appropriate |
Assume: SLD as a byte |
|
|
|
|
|
|
|
|
|
|
|
|
Delete a table from PostGIS (because Geoserver won't do it yet); |
|
Configure the layers available in GeoServer in GeoNode. |
|
|
|
Parameters: |
|
Retrieve layer attribute names & types from Geoserver, |
|
|
|
|
|
|
|
|
|
Decipher whether layer attribute is suitable for statistical derivation |
|
Generate statistics (range, mean, median, standard deviation, unique values) |
|
|
|
Returns a list of integers with the size of the coverage |
|
Deletes GeoServer and Catalogue records for a given name. |
|
|
|
|
|
|
|
Create a database store then use it to import a shapefile. |
|
|
|
|
|
Derive aggregate statistics from WPS endpoint |
|
|
|
|
|
Sync style stuff from GS to GN. |
|
Configure the time dimension for a layer. |
|
Get the configured time dimension metadata for the layer as a dict. |
|
|
|
|
|
|
|
|
|
Synchronizes the Django Instance with GeoServer layers. |
|
|
|
|
|
Filter the input files list for relevant files only |
|
Reutnrs 'vector' or 'raster' whether a file from the allowed extensins has been identified. |
|
Returns 'FeatureType.resource_type' or 'Coverage.resource_type' accordingly to the provided SpatialFiles |
|
Generate the layer-specific GetCapabilities URL |
|
Generate the layer-specific GetCapabilities URL |
|
|
|
Module Contents
- geonode.geoserver.helpers.temp_style_name_regex = '[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}_ms_.*'[source]
- geonode.geoserver.helpers.WPS_ACCEPTABLE_FORMATS = [('application/json', 'vector'), ('application/arcgrid', 'raster'), ('image/tiff', 'raster'),...[source]
- geonode.geoserver.helpers.DEFAULT_STYLE_NAME = ['generic', 'line', 'point', 'polygon', 'raster'][source]
- geonode.geoserver.helpers.msg = 'Please configure OGC_SERVER when enabling geonode.geoserver. More info can be found at...[source]
- geonode.geoserver.helpers.check_geoserver_is_up()[source]
Verifies all geoserver is running, this is needed to be able to upload.
- geonode.geoserver.helpers._add_sld_boilerplate(symbolizer)[source]
Wrap an XML snippet representing a single symbolizer in the appropriate elements to make it a valid SLD which applies that symbolizer to all features, including format strings to allow interpolating a “name” variable in.
- geonode.geoserver.helpers._raster_template = Multiline-String[source]
Show Value
""" <RasterSymbolizer> <Opacity>1.0</Opacity> </RasterSymbolizer> """
- geonode.geoserver.helpers._polygon_template = Multiline-String[source]
Show Value
""" <PolygonSymbolizer> <Fill> <CssParameter name="fill">%(bg)s</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">%(fg)s</CssParameter> <CssParameter name="stroke-width">0.7</CssParameter> </Stroke> </PolygonSymbolizer> """
- geonode.geoserver.helpers._line_template = Multiline-String[source]
Show Value
""" <LineSymbolizer> <Stroke> <CssParameter name="stroke">%(bg)s</CssParameter> <CssParameter name="stroke-width">3</CssParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <FeatureTypeStyle> <Rule> <LineSymbolizer> <Stroke> <CssParameter name="stroke">%(fg)s</CssParameter> </Stroke> </LineSymbolizer> """
- geonode.geoserver.helpers._point_template = Multiline-String[source]
Show Value
""" <PointSymbolizer> <Graphic> <Mark> <WellKnownName>%(mark)s</WellKnownName> <Fill> <CssParameter name="fill">%(bg)s</CssParameter> </Fill> <Stroke> <CssParameter name="stroke">%(fg)s</CssParameter> </Stroke> </Mark> <Size>10</Size> </Graphic> </PointSymbolizer> """
- geonode.geoserver.helpers.delete_from_postgis(dataset_name, store)[source]
Delete a table from PostGIS (because Geoserver won’t do it yet); to be used after deleting a layer from the system.
- geonode.geoserver.helpers.gs_slurp(ignore_errors=False, verbosity=1, console=None, owner=None, workspace=None, store=None, filter=None, skip_unadvertised=False, skip_geonode_registered=False, remove_deleted=False, permissions=None, execute_signals=False)[source]
Configure the layers available in GeoServer in GeoNode. It returns a list of dictionaries with the name of the layer, the result of the operation and the errors and traceback if it failed.
- geonode.geoserver.helpers.set_attributes(layer, attribute_map, overwrite=False, attribute_stats=None)[source]
Parameters:
layer: A geonode.layers.models.Dataset instance representing the dataset layer.
attribute_map: A list of 2-item lists specifying attribute names and types.
Example:
attribute_map = [ ['id', 'Integer'], ['name', 'String'], ['created_at', 'Date'] ]
overwrite: Boolean flag to replace existing attributes with new values if their name/type matches.
attribute_stats: A dictionary containing return values from get_attribute_statistics().
Structure:
attribute_stats = { "<dataset_name>": { "<field_name>": <stat_value> } }
Use attribute_stats[<dataset_name>][<field_name>] to access specific values.
- geonode.geoserver.helpers.set_attributes_from_geoserver(layer, overwrite=False)[source]
Retrieve layer attribute names & types from Geoserver, then store in GeoNode database using Attribute model
- geonode.geoserver.helpers.is_dataset_attribute_aggregable(store_type, field_name, field_type)[source]
Decipher whether layer attribute is suitable for statistical derivation
- geonode.geoserver.helpers.get_attribute_statistics(dataset_name, field)[source]
Generate statistics (range, mean, median, standard deviation, unique values) for layer attribute
- geonode.geoserver.helpers.get_coverage_grid_extent(instance)[source]
Returns a list of integers with the size of the coverage extent in pixels
- geonode.geoserver.helpers.cleanup(name, uuid)[source]
Deletes GeoServer and Catalogue records for a given name. Useful to clean the mess when something goes terribly wrong. It also verifies if the Django record existed, in which case it performs no action.
- geonode.geoserver.helpers.create_geoserver_db_featurestore(store_type=None, store_name=None, author_name='admin', author_email='admin@geonode.org', charset='UTF-8', workspace=None)[source]
- geonode.geoserver.helpers._create_featurestore(name, data, overwrite=False, charset='UTF-8', workspace=None)[source]
- geonode.geoserver.helpers._create_coveragestore(name, data, overwrite=False, charset='UTF-8', workspace=None)[source]
- geonode.geoserver.helpers._create_db_featurestore(name, data, overwrite=False, charset='UTF-8', workspace=None)[source]
Create a database store then use it to import a shapefile.
If the import into the database fails then delete the store (and delete the PostGIS table for it).
- geonode.geoserver.helpers.wps_execute_dataset_attribute_statistics(dataset_name, field)[source]
Derive aggregate statistics from WPS endpoint
- geonode.geoserver.helpers.style_update(request, url, workspace=None)[source]
Sync style stuff from GS to GN. Ideally we should call this from a view straight from GXP, and we should use gsConfig, that at this time does not support styles updates. Before gsConfig is updated, for now we need to parse xml. In case of a DELETE, we need to query request.path to get the style name, and then remove it. In case of a POST or PUT, we need to parse the xml from request.body, which is in this format:
- geonode.geoserver.helpers.set_time_info(layer, attribute, end_attribute, presentation, precision_value, precision_step, enabled=True)[source]
Configure the time dimension for a layer.
- Parameters:
layer – the layer to configure
attribute – the attribute used to represent the instant or period start
end_attribute – the optional attribute used to represent the end period
presentation – either ‘LIST’, ‘DISCRETE_INTERVAL’, or ‘CONTINUOUS_INTERVAL’
precision_value – number representing number of steps
precision_step – one of ‘seconds’, ‘minutes’, ‘hours’, ‘days’, ‘months’, ‘years’
enabled – defaults to True
- geonode.geoserver.helpers.get_time_info(layer)[source]
Get the configured time dimension metadata for the layer as a dict.
The keys of the dict will be those of the parameters of set_time_info.
- Returns:
dict of values or None if not configured
- geonode.geoserver.helpers._foregrounds = ['#ffbbbb', '#bbffbb', '#bbbbff', '#ffffbb', '#bbffff', '#ffbbff'][source]
- geonode.geoserver.helpers._backgrounds = ['#880000', '#008800', '#000088', '#888800', '#008888', '#880088'][source]
- geonode.geoserver.helpers.set_time_dimension(cat, name, workspace, time_presentation, time_presentation_res, time_presentation_default_value, time_presentation_reference_value)[source]
- geonode.geoserver.helpers.sync_instance_with_geoserver(instance_id, *args, **kwargs)[source]
Synchronizes the Django Instance with GeoServer layers.
- geonode.geoserver.helpers.select_relevant_files(allowed_extensions, files)[source]
Filter the input files list for relevant files only
Relevant files are those whose extension is in the
allowed_extensionsiterable.- Parameters:
allowed_extensions – list of strings with the extensions to keep
files – list of django files with the files to be filtered
- geonode.geoserver.helpers.get_spatial_files_dataset_type(allowed_extensions, files, charset='UTF-8') SpatialFilesLayerType[source]
Reutnrs ‘vector’ or ‘raster’ whether a file from the allowed extensins has been identified.
- geonode.geoserver.helpers.get_dataset_type(spatial_files)[source]
Returns ‘FeatureType.resource_type’ or ‘Coverage.resource_type’ accordingly to the provided SpatialFiles
- geonode.geoserver.helpers.get_dataset_capabilities_url(layer, version='1.3.0', access_token=None)[source]
Generate the layer-specific GetCapabilities URL