diff --git a/README.md b/README.md
index 2bedcae..38184c0 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,8 @@ cd pygeoapi_venv
Scripts\activate
cd pygeoapi
// git clone https://github.com/specklesystems/pygeoapi
-cd pygeoapi
git checkout dev
-git reset --hard dev
+// git reset --hard dev
// pip install --upgrade pip
// pip install -r requirements.txt
python setup.py install
diff --git a/pygeoapi/config.py b/pygeoapi/config.py
index e8f8974..fd994dc 100644
--- a/pygeoapi/config.py
+++ b/pygeoapi/config.py
@@ -76,19 +76,6 @@ def get_config(raw: bool = False, request: Request = None) -> dict:
if CONFIG == {}:
CONFIG = config_yaml
- # if a key found, replace basemap URL to MapTiler
- # make sure to restrict the usage for the key
- if map_api_key_speckle and len(map_api_key_speckle)>=20:
- CONFIG["server"]["map"]["url"] = r'https://api.maptiler.com/maps/dataviz/{z}/{x}/{y}.png' + f'?key={map_api_key_speckle}'
- CONFIG["server"]["map"]["attribution"] = r'© MapTiler © OpenStreetMap contributors'
-
- elif map_api_key_local and len(map_api_key_local)>=20:
- CONFIG["server"]["map"]["url"] = r'https://api.maptiler.com/maps/dataviz/{z}/{x}/{y}.png' + f'?key={map_api_key_local}'
- CONFIG["server"]["map"]["attribution"] = r'© MapTiler © OpenStreetMap contributors'
- else:
- CONFIG["server"]["map"]["url"] = r'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
- CONFIG["server"]["map"]["attribution"] = r'© OpenStreetMap contributors'
-
url_valid = False
speckle_url = ""
if request is not None:
@@ -97,6 +84,20 @@ def get_config(raw: bool = False, request: Request = None) -> dict:
url_valid = True
speckle_url = url
+ # if a key found, replace basemap URL to MapTiler
+ # make sure to restrict the usage for the key
+ if ".speckle.systems" in request.url.split("?")[0] and map_api_key_speckle and len(map_api_key_speckle)>=20:
+ CONFIG["server"]["map"]["url"] = r'https://api.maptiler.com/maps/dataviz/{z}/{x}/{y}.png' + f'?key={map_api_key_speckle}'
+ CONFIG["server"]["map"]["attribution"] = r'© MapTiler © OpenStreetMap contributors'
+
+ elif map_api_key_local and len(map_api_key_local)>=20:
+ CONFIG["server"]["map"]["url"] = r'https://api.maptiler.com/maps/dataviz/{z}/{x}/{y}.png' + f'?key={map_api_key_local}'
+ CONFIG["server"]["map"]["attribution"] = r'© MapTiler © OpenStreetMap contributors'
+ else:
+ CONFIG["server"]["map"]["url"] = r'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
+ CONFIG["server"]["map"]["attribution"] = r'© OpenStreetMap contributors'
+
+
# once Speckle URL is found, set it as a provider
if url_valid:
# speckle_collection_pts["title"]["en"] = "Some Points"
diff --git a/pygeoapi/provider/speckle_utils/converter_utils.py b/pygeoapi/provider/speckle_utils/converter_utils.py
index 622c48e..81f9979 100644
--- a/pygeoapi/provider/speckle_utils/converter_utils.py
+++ b/pygeoapi/provider/speckle_utils/converter_utils.py
@@ -17,7 +17,7 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
geometry["type"] = "MultiPoint"
coord_counts.append(None)
- coords.append([f_base.x, f_base.y])
+ coords.append([f_base.x, f_base.y, f_base.z])
coord_counts.append([1])
elif isinstance(f_base, Mesh) or isinstance(f_base, Brep):
@@ -58,7 +58,8 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
for vertex_index in faces[count + 1 : count + 1 + pt_count]:
x = vertices[vertex_index * 3]
y = vertices[vertex_index * 3 + 1]
- coords.append([x, y])
+ z = vertices[vertex_index * 3 + 2]
+ coords.append([x, y, z])
count += pt_count + 1
@@ -70,7 +71,7 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
coord_counts.append(None)
for geom in f_base.geometry:
- coords.append([geom.x, geom.y])
+ coords.append([geom.x, geom.y, geom.z])
coord_counts.append([1])
elif isinstance(f_base.geometry[0], Polyline):
@@ -82,7 +83,7 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
local_poly_count = 0
for pt in geom.as_points():
- coords.append([pt.x, pt.y])
+ coords.append([pt.x, pt.y, pt.z])
local_poly_count += 1
if len(coords)>2 and geom.closed is True and coords[0] != coords[-1]:
coords.append(coords[0])
@@ -98,7 +99,7 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
coord_counts.append([])
boundary_count = 0
for pt in polygon.boundary.as_points():
- coords.append([pt.x, pt.y])
+ coords.append([pt.x, pt.y, pt.z])
boundary_count += 1
coord_counts[-1].append(boundary_count)
@@ -106,15 +107,15 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
for void in polygon.voids:
void_count = 0
for pt_void in void.as_points():
- coords.append([pt_void.x, pt_void.y])
+ coords.append([pt_void.x, pt_void.y, pt_void.z])
void_count += 1
coord_counts[-1].append(void_count)
elif isinstance(f_base, Line):
geometry["type"] = "LineString"
- start = [f_base.start.x, f_base.start.y]
- end = [f_base.end.x, f_base.end.y]
+ start = [f_base.start.x, f_base.start.y, f_base.start.z]
+ end = [f_base.end.x, f_base.end.y, f_base.end.z]
coords.extend([start, end])
coord_counts.append([2])
@@ -122,7 +123,7 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
elif isinstance(f_base, Polyline):
geometry["type"] = "LineString"
for pt in f_base.as_points():
- coords.append([pt.x, pt.y])
+ coords.append([pt.x, pt.y, pt.z])
if len(coords)>2 and f_base.closed is True and coords[0] != coords[-1]:
coords.append(coords[0])
@@ -131,7 +132,7 @@ def assign_geometry(feature: Dict, f_base) -> ( List[List[List[float]]], List[Li
elif isinstance(f_base, Curve):
geometry["type"] = "LineString"
for pt in f_base.displayValue.as_points():
- coords.append([pt.x, pt.y])
+ coords.append([pt.x, pt.y, pt.z])
if len(coords)>2 and f_base.displayValue.closed is True and coords[0] != coords[-1]:
coords.append(coords[0])
diff --git a/pygeoapi/provider/speckle_utils/coords_utils.py b/pygeoapi/provider/speckle_utils/coords_utils.py
index 7abefe4..e46a701 100644
--- a/pygeoapi/provider/speckle_utils/coords_utils.py
+++ b/pygeoapi/provider/speckle_utils/coords_utils.py
@@ -76,7 +76,8 @@ def reproject_2d_coords_list(self, coords_in: List[List[float]]) -> List[List[fl
CRS.from_user_input(4326),
always_xy=True,
)
- return [[pt[0], pt[1]] for pt in transformer.itransform(coords_offset)]
+ transformed = [[pt[0], pt[1], pt[2]] for pt in transformer.itransform(coords_offset)]
+ return transformed
def offset_rotate(self, coords_in: List[list]) -> List[List[float]]:
"""Apply offset and rotation to coordinates, according to SpeckleProvider CRS_dict."""
@@ -96,6 +97,7 @@ def offset_rotate(self, coords_in: List[list]) -> List[List[float]]:
[
scale_factor * (x2 + self.crs_dict["offset_x"]),
scale_factor * (y2 + self.crs_dict["offset_y"]),
+ scale_factor * (coord[2]),
]
)