Restructure api

Fixes in geo api, registry
Cleanups
This commit is contained in:
phil 2024-02-27 05:05:33 +05:30
parent c84dd61f6a
commit 8c299f0041
17 changed files with 212 additions and 162 deletions

View file

@ -16,6 +16,7 @@ from redis import asyncio as aioredis
from gisaf.config import conf
# from gisaf.models.live import LiveModel
from gisaf.models.map_bases import MaplibreStyle
from gisaf.utils import (SHAPELY_TYPE_TO_MAPBOX_TYPE, DEFAULT_MAPBOX_LAYOUT,
DEFAULT_MAPBOX_PAINT, gisTypeSymbolMap)
from gisaf.registry import registry
@ -281,18 +282,14 @@ class Store:
registry.geom_live_defs[model_info['store']] = model_info
registry.update_live_layers()
async def get_mapbox_style(self, store_name):
async def get_maplibre_style(self, store_name) -> MaplibreStyle:
"""
Get the http headers (mapbox style) from the store name (layer_def)
"""
paint = await self.redis.get(self.get_mapbox_paint_channel(store_name))
layout = await self.redis.get(self.get_mapbox_layout_channel(store_name))
style = {}
if paint is not None:
style['paint'] = paint.decode()
if layout is not None:
style['layout'] = layout.decode()
return style
return MaplibreStyle(
paint=(await self.redis.get(self.get_mapbox_paint_channel(store_name))).decode(),
layout=(await self.redis.get(self.get_mapbox_layout_channel(store_name))).decode(),
)
async def get_layer_as_json(self, store_name):
"""