Skip to content

Commit a1fde89

Browse files
committed
Fix dependencies issues between shapely and MVT and free localost from osmose.openstreetmap.fr
1 parent 58d0365 commit a1fde89

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ web/po/vue.pot
88

99
web_api/session/
1010
web_api/public/
11-
web_api/static/
11+
web_api/static/node_modules
1212

1313
web/static/.webassets-cache/
1414
web/static/gen/

osmose.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22

33
from fastapi import Depends, FastAPI, HTTPException, Request, Response, responses
4+
from fastapi.middleware.cors import CORSMiddleware
45

56
from api import app as api
67
from control import app as control
@@ -11,6 +12,20 @@
1112

1213
app = FastAPI()
1314

15+
origins = [
16+
"https://osmose.openstreetmap.fr",
17+
"http://localhost",
18+
"http://localhost:8080",
19+
"http://localhost:20009",
20+
]
21+
22+
app.add_middleware(
23+
CORSMiddleware,
24+
allow_origins=origins,
25+
allow_credentials=True,
26+
allow_methods=["*"],
27+
allow_headers=["*"],
28+
)
1429

1530
@app.on_event("startup")
1631
async def startup():
@@ -58,6 +73,16 @@ def sprite_png():
5873
return Response(open("web_api/public/assets/sprite.png", "rb").read())
5974

6075

76+
@app.get("/assets/marker-gl-sprite.json")
77+
def sprite_png():
78+
return Response(open("web_api/public/assets/marker-gl-sprite.json", "rb").read())
79+
80+
81+
@app.get("/assets/marker-gl-sprite.png")
82+
def sprite_png():
83+
return Response(open("web_api/public/assets/marker-gl-sprite.png", "rb").read())
84+
85+
6186
@app.get("/images/markers/{filename:path}.png")
6287
def marker(filename):
6388
file_path = f"web_api/static/images/markers/{filename}.png"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ matplotlib >= 1.1
33
requests >= 2.0
44
polib
55
protobuf < 4 # 4.x binary not yet compatible with system package, deps of mapbox-vector-tile
6+
shapely < 2.1.0 # cascaded_union function removal, deps of mapbox-vector-tile
67
mapbox-vector-tile
78
pyclipper
89
fastapi

web/static/map/layers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { SourceSpecification } from 'maplibre-gl'
22

3+
declare var API_URL: string;
4+
35
function tileSource(url, options?): SourceSpecification {
46
return {
57
type: 'raster',
@@ -98,8 +100,6 @@ export const mapOverlay = {
98100
heatmap: 'Osmose Issues Heatmap',
99101
}
100102

101-
const API_URL = 'https://osmose.openstreetmap.fr'
102-
103103
export const glStyle = {
104104
version: 8,
105105
sources: {

web/types/index.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

web_api/static/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = (env, argv) => {
1010
},
1111
plugins: [
1212
new SpritezeroWebpackPlugin({
13-
source: '../web_api/static/images/**/*.svg',
13+
source: 'images/**/*.svg',
1414
output: 'marker-gl-',
1515
})
1616
],

0 commit comments

Comments
 (0)