Skip to content

Commit

Permalink
Some improvement to the createlayer application
Browse files Browse the repository at this point in the history
  • Loading branch information
capooti committed May 10, 2018
1 parent 500dcc3 commit b29abc5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions geonode/contrib/createlayer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

logger = logging.getLogger(__name__)

bbox = [-180, 180, -90, 90]


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

Expand Down Expand Up @@ -226,12 +228,13 @@ def create_gs_layer(name, title, geometry_type, attributes=None):
"<nativeName>{native_name}</nativeName>"
"<title>{title}</title>"
"<srs>EPSG:4326</srs>"
"<latLonBoundingBox><minx>-180</minx><maxx>180</maxx><miny>-90</miny><maxy>90</maxy>"
"<latLonBoundingBox><minx>{minx}</minx><maxx>{maxx}</maxx><miny>{miny}</miny><maxy>{maxy}</maxy>"
"<crs>EPSG:4326</crs></latLonBoundingBox>"
"{attributes}"
"</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],
attributes=attributes_block)

url = ('%s/workspaces/%s/datastores/%s/featuretypes'
Expand Down

0 comments on commit b29abc5

Please sign in to comment.