Skip to content

Commit

Permalink
[Minor] Do not relay on Django geometry transform to project the ll_bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Nov 25, 2021
1 parent 36a5111 commit 0fa57a4
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@
DEFAULT_SUPPLEMENTAL_INFORMATION)
from geonode.base.bbox_utils import BBOXHelper, polygon_from_bbox
from geonode.utils import (
is_monochromatic_image,
add_url_params,
bbox_to_wkt,
find_by_attr
find_by_attr,
add_url_params,
bbox_to_projection,
is_monochromatic_image
)
from geonode.groups.models import GroupProfile
from geonode.security.utils import get_visible_resources, get_geoapp_subtypes
Expand Down Expand Up @@ -1348,7 +1349,18 @@ def set_bbox_polygon(self, bbox, srid):
match = re.match(r'^(EPSG:)?(?P<srid>\d{4,6})$', str(srid))
bbox_polygon.srid = int(match.group('srid')) if match else 4326
try:
self.ll_bbox_polygon = bbox_polygon.transform(4326, clone=True)
# self.ll_bbox_polygon = bbox_polygon.transform(4326, clone=True)
# self.ll_bbox_polygon = Polygon.from_bbox(
# bbox_to_projection(
# [
# bbox_polygon.extent[0],
# bbox_polygon.extent[2],
# bbox_polygon.extent[1],
# bbox_polygon.extent[3]
# ] + [f'EPSG:{bbox_polygon.srs.srid}']
# )[:-1])
self.ll_bbox_polygon = Polygon.from_bbox(
bbox_to_projection(list(bbox_polygon.extent) + [srid])[:-1])
except Exception as e:
logger.error(e)
self.ll_bbox_polygon = bbox_polygon
Expand Down

0 comments on commit 0fa57a4

Please sign in to comment.