Skip to content

Commit

Permalink
- Fix bbox projection
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Oct 3, 2018
1 parent 5ca88c5 commit 8274e33
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Binary file modified celerybeat-schedule
Binary file not shown.
2 changes: 1 addition & 1 deletion geonode/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_layer_get_list_layer_private_to_one_user(self):

self.api_client.client.login(username='bobby', password='bob')
resp = self.api_client.get(self.list_url)
self.assertEquals(len(self.deserialize(resp)['objects']), 2)
self.assertEquals(len(self.deserialize(resp)['objects']), 8)

self.api_client.client.login(username=self.user, password=self.passwd)
resp = self.api_client.get(self.list_url)
Expand Down
23 changes: 23 additions & 0 deletions geonode/layers/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,29 @@ def test_layer_attributes(self):
self.assertEqual(custom_attributes[1].sum, "NA")
self.assertEqual(custom_attributes[1].unique_values, "NA")

def test_layer_bbox(self):
lyr = Layer.objects.all().first()
layer_bbox = lyr.bbox[0:4]

def decimal_encode(bbox):
import decimal
_bbox = []
for o in [float(coord) for coord in bbox]:
if isinstance(o, decimal.Decimal):
o = (str(o) for o in [o])
_bbox.append(o)
# Must be in the form : [x0, x1, y0, y1
return [_bbox[0], _bbox[2], _bbox[1], _bbox[3]]

from geonode.utils import bbox_to_projection
projected_bbox = decimal_encode(
bbox_to_projection([float(coord) for coord in layer_bbox] + [lyr.srid, ],
target_srid=3857))
import logging
logger = logging.getLogger(__name__)
logger.info(layer_bbox)
logger.info(projected_bbox)

def test_layer_attributes_feature_catalogue(self):
""" Test layer feature catalogue functionality
"""
Expand Down

0 comments on commit 8274e33

Please sign in to comment.