diff --git a/deployment/production/build.sh b/deployment/production/build.sh index 5fdfa22..64a63c4 100755 --- a/deployment/production/build.sh +++ b/deployment/production/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ -z "$REPO_NAME" ]; then - REPO_NAME=kartoza + REPO_NAME=andretheronsa fi if [ -z "$IMAGE_NAME" ]; then @@ -9,7 +9,7 @@ if [ -z "$IMAGE_NAME" ]; then fi if [ -z "$TAG_NAME" ]; then - TAG_NAME=latest + TAG_NAME=2.0 fi if [ -z "$BUILD_ARGS" ]; then @@ -19,7 +19,7 @@ fi # Build Args Environment if [ -z "$BIMS_TAG" ]; then - BIMS_TAG=develop + BIMS_TAG=2.0 fi echo "BIMS_TAG=${BIMS_TAG}" diff --git a/django_project/geocontext/models/utilities.py b/django_project/geocontext/models/utilities.py index 34c9fe1..39fc7bb 100644 --- a/django_project/geocontext/models/utilities.py +++ b/django_project/geocontext/models/utilities.py @@ -59,6 +59,7 @@ def retrieve_external_csr(util_arg): else: return None + def get_session(): """Get thread local request session""" if not hasattr(thread_local, "session"): @@ -101,7 +102,7 @@ def __init__(self, csr_key, x, y, srid=4326): # Geometry defaults to generalized point - for basic cache hits. self.x = x - self.y = y + self.y = y self.query_srid = srid self.generalize_point() self.geometry = self.point @@ -131,10 +132,11 @@ def generalize_point(self): :return: point :rtype: Point """ - + if self.query_srid != self.srid: point = Point( - *convert_coordinate(self.x, self.y, self.query_srid, self.srid), + *convert_coordinate( + self.x, self.y, self.query_srid, self.srid), srid=self.srid ) else: @@ -189,7 +191,8 @@ def retrieve_context_value(self): self.value = e return True - if self.query_type in [ServiceDefinitions.ARCREST, ServiceDefinitions.PLACENAME]: + if self.query_type in [ + ServiceDefinitions.ARCREST, ServiceDefinitions.PLACENAME]: build_url = self.build_query_url() build_content = self.request_content(build_url) if build_content is not None: @@ -212,11 +215,13 @@ def retrieve_context_value(self): return True build_url = self.build_query_url() - build_content = self.request_content(build_url) + build_content = self.request_content(build_url) if build_content is not None: - geometry = parse_gml_geometry(build_content, self.layer_typename) + geometry = parse_gml_geometry( + build_content, self.layer_typename) if geometry is not None: - geometry.srid = self.srid if not geometry.srid else geometry.srid + if not geometry.srid: + geometry.srid = self.srid self.geometry = geometry self.cache_url = build_url @@ -237,7 +242,9 @@ def request_content(self, url, retries=0): if response.status_code == 200: return response.content except requests.exceptions.RequestException as e: - LOGGER.error(f"'{self.service_registry_key}' url failed: {url} with: {e}") + LOGGER.error( + f"'{self.service_registry_key}' url failed: {url} with: {e}" + ) return None def parse_request_value(self, request_content): @@ -317,7 +324,7 @@ def build_query_url(self): else: url = f'{self.url}/identify?{query_dict.urlencode()}' url += f'&mapExtent={bbox_string}' - + elif self.query_type == ServiceDefinitions.PLACENAME: parameters = { 'lat': str(self.point.y), diff --git a/django_project/geocontext/tests/test_utilities.py b/django_project/geocontext/tests/test_utilities.py index f955ef0..593f5e9 100644 --- a/django_project/geocontext/tests/test_utilities.py +++ b/django_project/geocontext/tests/test_utilities.py @@ -2,14 +2,10 @@ """Test for utilities module.""" import os -import unittest from django.test import SimpleTestCase from geocontext.utilities import ( - convert_coordinate, parse_gml_geometry, convert_2d_to_3d, get_bbox) -from django.contrib.gis.geos import ( - Point, LineString, LinearRing, Polygon, MultiPoint, - MultiLineString, MultiPolygon) + convert_coordinate, parse_gml_geometry, get_bbox) test_data_directory = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'data') diff --git a/django_project/geocontext/utilities.py b/django_project/geocontext/utilities.py index 28c2983..43fc766 100644 --- a/django_project/geocontext/utilities.py +++ b/django_project/geocontext/utilities.py @@ -1,7 +1,6 @@ # coding=utf-8 """Utilities module for geocontext app.""" import logging -import requests from xml.dom import minidom import xml.etree.ElementTree as ET @@ -75,7 +74,7 @@ def parse_gml_geometry(gml_string, tag_name='qgs:geometry'): logger.error(f'Could not parse GML string: {e}') return None try: - if tag_name == 'qgs:geometry': + if tag_name == 'qgs:geometry': geometry_dom = xmldoc.getElementsByTagName(tag_name)[0] geometry_gml_dom = geometry_dom.childNodes[1] return GEOSGeometry.from_gml(geometry_gml_dom.toxml())