Skip to content

Commit

Permalink
Now thumbanils are not generate from layers which are created. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
capooti committed May 10, 2018
1 parent 272017b commit c5540fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 8 additions & 6 deletions geonode/contrib/createlayer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@

logger = logging.getLogger(__name__)

bbox = [-180, 180, -90, 90]
BBOX = [-180, 180, -90, 90]
DATA_QUALITY_MESSAGE = "Created with GeoNode"


def create_layer(name, title, owner_name, geometry_type, attributes=None):
Expand Down Expand Up @@ -72,10 +73,11 @@ def create_gn_layer(workspace, datastore, name, title, owner_name):
title=title,
owner=owner,
uuid=str(uuid.uuid4()),
bbox_x0=bbox[0],
bbox_x1=bbox[1],
bbox_y0=bbox[2],
bbox_y1=bbox[3]
bbox_x0=BBOX[0],
bbox_x1=BBOX[1],
bbox_y0=BBOX[2],
bbox_y1=BBOX[3],
data_quality_statement=DATA_QUALITY_MESSAGE,
)
return layer

Expand Down Expand Up @@ -234,7 +236,7 @@ def create_gs_layer(name, title, geometry_type, attributes=None):
"</featureType>").format(
name=name.encode('UTF-8', 'strict'), native_name=native_name.encode('UTF-8', 'strict'),
title=title.encode('UTF-8', 'strict'),
minx=bbox[0], maxx=bbox[1], miny=bbox[2], maxy=bbox[3],
minx=BBOX[0], maxx=BBOX[1], miny=BBOX[2], maxy=BBOX[3],
attributes=attributes_block)

url = ('%s/workspaces/%s/datastores/%s/featuretypes'
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion geonode/contrib/worldmap/wm_extra/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from geonode.layers.utils import create_gs_thumbnail_geonode
from geonode.layers.models import Layer
from geonode.contrib.createlayer.utils import DATA_QUALITY_MESSAGE

def create_wm_thumbnail(instance, overwrite=False):
"""
WorldMap doesn't use thumbnails from GeoServer, but just the ones from html.
"""
# we use the standard way just for layers, not for maps
if isinstance(instance, Layer):
create_gs_thumbnail_geonode(instance)
# layer created by createlayer application don't need a thumbnail
if not instance.data_quality_statement == DATA_QUALITY_MESSAGE:
create_gs_thumbnail_geonode(instance)
else:
return None

0 comments on commit c5540fb

Please sign in to comment.