mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 20:36:21 -05:00
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically. Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config. PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
This commit is contained in:
parent
4072ac30ed
commit
adb0adbd94
27 changed files with 2115 additions and 170 deletions
|
|
@ -20,7 +20,7 @@ def get_files(_: Request):
|
|||
return json_response(dict(files=files), HTTPStatus.OK)
|
||||
|
||||
|
||||
@map_bp.delete('/files/<filename:str>')
|
||||
@map_bp.delete('/files/<filename:path>')
|
||||
@openapi.description('Delete a PMTiles map file')
|
||||
@wrol_mode_check
|
||||
async def delete_file(_: Request, filename: str):
|
||||
|
|
@ -34,6 +34,21 @@ async def delete_file(_: Request, filename: str):
|
|||
return response.json({'error': 'File not found'}, HTTPStatus.NOT_FOUND)
|
||||
|
||||
|
||||
@map_bp.post('/files/visible')
|
||||
@openapi.description('Show a PMTiles map file on the map, or ignore it')
|
||||
@validate(schema.MapFileVisibleRequest)
|
||||
@wrol_mode_check
|
||||
async def post_file_visible(_: Request, body: schema.MapFileVisibleRequest):
|
||||
try:
|
||||
found = lib.set_pmtiles_file_visible(body.map_path, body.visible)
|
||||
except ValueError as e:
|
||||
return response.json({'error': str(e)}, HTTPStatus.BAD_REQUEST)
|
||||
|
||||
if found:
|
||||
return response.empty()
|
||||
return response.json({'error': 'File not found'}, HTTPStatus.NOT_FOUND)
|
||||
|
||||
|
||||
@map_bp.get('/subscribe')
|
||||
@openapi.description('Get map catalog and current subscriptions')
|
||||
def get_subscriptions(request: Request):
|
||||
|
|
@ -148,7 +163,7 @@ async def rebuild_search_indexes(_: Request):
|
|||
return json_response({'error': 'No PMTiles files found'}, HTTPStatus.NOT_FOUND)
|
||||
|
||||
|
||||
@map_bp.post('/search/rebuild/<filename:str>')
|
||||
@map_bp.post('/search/rebuild/<filename:path>')
|
||||
@openapi.description('Rebuild search index for a single PMTiles file')
|
||||
@wrol_mode_check
|
||||
async def rebuild_single_search_index(_: Request, filename: str):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue