geo-activity-playground 0.35.1__py3-none-any.whl → 0.36.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. geo_activity_playground/core/activities.py +21 -13
  2. geo_activity_playground/core/raster_map.py +9 -13
  3. geo_activity_playground/importers/directory.py +6 -15
  4. geo_activity_playground/webui/app.py +27 -35
  5. geo_activity_playground/webui/{auth/blueprint.py → auth_blueprint.py} +1 -1
  6. geo_activity_playground/webui/{eddington/controller.py → eddington_blueprint.py} +17 -13
  7. geo_activity_playground/webui/heatmap/blueprint.py +36 -10
  8. geo_activity_playground/webui/heatmap/heatmap_controller.py +142 -60
  9. geo_activity_playground/webui/heatmap/templates/heatmap/index.html.j2 +30 -12
  10. geo_activity_playground/webui/{search/blueprint.py → search_blueprint.py} +1 -1
  11. geo_activity_playground/webui/settings/blueprint.py +1 -2
  12. geo_activity_playground/webui/square_planner_blueprint.py +118 -0
  13. geo_activity_playground/webui/{summary/controller.py → summary_blueprint.py} +23 -23
  14. geo_activity_playground/webui/templates/page.html.j2 +11 -0
  15. geo_activity_playground/webui/tile_blueprint.py +42 -0
  16. geo_activity_playground/webui/upload_blueprint.py +1 -3
  17. {geo_activity_playground-0.35.1.dist-info → geo_activity_playground-0.36.0.dist-info}/METADATA +1 -1
  18. {geo_activity_playground-0.35.1.dist-info → geo_activity_playground-0.36.0.dist-info}/RECORD +26 -34
  19. geo_activity_playground/webui/eddington/__init__.py +0 -0
  20. geo_activity_playground/webui/eddington/blueprint.py +0 -16
  21. geo_activity_playground/webui/square_planner/__init__.py +0 -0
  22. geo_activity_playground/webui/square_planner/blueprint.py +0 -38
  23. geo_activity_playground/webui/square_planner/controller.py +0 -101
  24. geo_activity_playground/webui/summary/__init__.py +0 -0
  25. geo_activity_playground/webui/summary/blueprint.py +0 -14
  26. geo_activity_playground/webui/tile/__init__.py +0 -0
  27. geo_activity_playground/webui/tile/blueprint.py +0 -29
  28. geo_activity_playground/webui/tile/controller.py +0 -36
  29. /geo_activity_playground/webui/{auth/templates → templates}/auth/index.html.j2 +0 -0
  30. /geo_activity_playground/webui/{eddington/templates → templates}/eddington/index.html.j2 +0 -0
  31. /geo_activity_playground/webui/{search/templates → templates}/search/index.html.j2 +0 -0
  32. /geo_activity_playground/webui/{square_planner/templates → templates}/square_planner/index.html.j2 +0 -0
  33. /geo_activity_playground/webui/{summary/templates → templates}/summary/index.html.j2 +0 -0
  34. {geo_activity_playground-0.35.1.dist-info → geo_activity_playground-0.36.0.dist-info}/LICENSE +0 -0
  35. {geo_activity_playground-0.35.1.dist-info → geo_activity_playground-0.36.0.dist-info}/WHEEL +0 -0
  36. {geo_activity_playground-0.35.1.dist-info → geo_activity_playground-0.36.0.dist-info}/entry_points.txt +0 -0
File without changes
@@ -1,14 +0,0 @@
1
- from flask import Blueprint
2
- from flask import render_template
3
-
4
- from .controller import SummaryController
5
-
6
-
7
- def make_summary_blueprint(summary_controller: SummaryController) -> Blueprint:
8
- blueprint = Blueprint("summary", __name__, template_folder="templates")
9
-
10
- @blueprint.route("/")
11
- def index():
12
- return render_template("summary/index.html.j2", **summary_controller.render())
13
-
14
- return blueprint
File without changes
@@ -1,29 +0,0 @@
1
- from flask import Blueprint
2
- from flask import Response
3
-
4
- from .controller import TileController
5
-
6
-
7
- def make_tile_blueprint(tile_controller: TileController) -> Blueprint:
8
- blueprint = Blueprint("tiles", __name__, template_folder="templates")
9
-
10
- @blueprint.route("/color/<z>/<x>/<y>.png")
11
- def tile_color(x: str, y: str, z: str):
12
- return Response(
13
- tile_controller.render_color(int(x), int(y), int(z)), mimetype="image/png"
14
- )
15
-
16
- @blueprint.route("/grayscale/<z>/<x>/<y>.png")
17
- def tile_grayscale(x: str, y: str, z: str):
18
- return Response(
19
- tile_controller.render_grayscale(int(x), int(y), int(z)),
20
- mimetype="image/png",
21
- )
22
-
23
- @blueprint.route("/pastel/<z>/<x>/<y>.png")
24
- def tile_pastel(x: str, y: str, z: str):
25
- return Response(
26
- tile_controller.render_pastel(int(x), int(y), int(z)), mimetype="image/png"
27
- )
28
-
29
- return blueprint
@@ -1,36 +0,0 @@
1
- import io
2
-
3
- import matplotlib.pyplot as pl
4
- import numpy as np
5
-
6
- from geo_activity_playground.core.config import Config
7
- from geo_activity_playground.core.raster_map import get_tile
8
-
9
-
10
- class TileController:
11
- def __init__(self, config: Config):
12
- self._config = config
13
-
14
- def render_color(self, x: int, y: int, z: int) -> bytes:
15
- map_tile = np.array(get_tile(z, x, y, self._config.map_tile_url)) / 255
16
- f = io.BytesIO()
17
- pl.imsave(f, map_tile, format="png")
18
- return bytes(f.getbuffer())
19
-
20
- def render_grayscale(self, x: int, y: int, z: int) -> bytes:
21
- map_tile = np.array(get_tile(z, x, y, self._config.map_tile_url)) / 255
22
- map_tile = np.sum(map_tile * [0.2126, 0.7152, 0.0722], axis=2) # to grayscale
23
- map_tile = np.dstack((map_tile, map_tile, map_tile)) # to rgb
24
- f = io.BytesIO()
25
- pl.imsave(f, map_tile, format="png")
26
- return bytes(f.getbuffer())
27
-
28
- def render_pastel(self, x: int, y: int, z: int) -> bytes:
29
- map_tile = np.array(get_tile(z, x, y, self._config.map_tile_url)) / 255
30
- averaged_tile = np.sum(map_tile * [0.2126, 0.7152, 0.0722], axis=2)
31
- grayscale_tile = np.dstack((averaged_tile, averaged_tile, averaged_tile))
32
- factor = 0.7
33
- pastel_tile = factor * grayscale_tile + (1 - factor) * map_tile
34
- f = io.BytesIO()
35
- pl.imsave(f, pastel_tile, format="png")
36
- return bytes(f.getbuffer())