Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ services:
- PAG_FILE_SERVER
- ROUTING_GRAPHHOPPER_API_KEY
- PROXYWMSURL
- UPLOAD_VT_STYLE_URL
- DELETE_VT_STYLE_URL
- VECTORTILESURL
ports:
- 8080:8080
Expand Down
3 changes: 3 additions & 0 deletions env.default
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ GDAL_DISABLE_READDIR_ON_OPEN=TRUE
no_proxy=webpack_dev_server

PROXYWMSURL=https://map.geoportail.lu/ogcproxywms
UPLOAD_VT_STYLE_URL=
# https://migration.geoportail.lu/uploadvtstyle
DELETE_VT_STYLE_URL=https://migration.geoportail.lu/deletevtstyle
VECTORTILESURL=https://vectortiles-staging.geoportail.lu
4 changes: 2 additions & 2 deletions env.project
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ ARCGIS_USER=dummy
ARCGIS_PASS=dummy
ARCGIS_TOKEN_VALIDITY=dummy
ARCGIS_TOKEN_REFERER=dummy
http_proxy=http://proxy.geoportail.lu:3128
https_proxy=http://proxy.geoportail.lu:3128
#http_proxy=http://proxy.geoportail.lu:3128
#https_proxy=http://proxy.geoportail.lu:3128
3 changes: 3 additions & 0 deletions geoportal/geoportailv3_geoportal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ def main(global_config, **settings):
config.add_route('upload_vt_style', '/uploadvtstyle')
config.add_route('delete_vt_style', '/deletevtstyle')
config.add_route('get_vt_style', '/getvtstyle')
config.add_route('upload_permalink_style', '/uploadpermalinkstyle')
config.add_route('delete_permalink_style', '/deletepermalinkstyle')
config.add_route('get_permalink_style', '/getpermalinkstyle')
config.add_route('profile.csv', '/profile.csv')

# Service worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
RemoteLayers,
HeaderBar,
proxyUrlHelper,
styleUrlHelper,
useMap,
useMvtStyles,
useOpenLayers,
Expand Down Expand Up @@ -465,7 +466,7 @@ const MainController = function(
ngeoDownload, appMvtStylingService, ngeoDebounce, geonetworkBaseUrl, appBlankLayer,
proxyWmsUrl,
httpsProxyUrl,
getvtstyleUrl, uploadvtstyleUrl, deletevtstyleUrl, vectortilesUrl) {
getvtpermalinkUrl, uploadvtpermalinkUrl, deletevtpermalinkUrl, vectortilesUrl) {
/**
* @type {app.backgroundlayer.BlankLayer}
* @private
Expand Down Expand Up @@ -766,16 +767,14 @@ const MainController = function(
this.backgroundLayerMgr_ = ngeoBackgroundLayerMgr;
this.mapStore_ = useMapStore()
this.styleStore_ = useStyleStore()
this.styleService_ = useMvtStyles()

this.styleService_.setRegisterUrl_v3({
get: getvtstyleUrl,
upload: uploadvtstyleUrl,
delete: deletevtstyleUrl,
styleUrlHelper.setRegisterUrl_v3({
get: getvtpermalinkUrl,
upload: uploadvtpermalinkUrl,
delete: deletevtpermalinkUrl,
vectortiles: vectortilesUrl
})

this.styleService_.initBackgroundsConfigs()
useMvtStyles().initBackgroundsConfigs()

/**
* @type {app.draw.DrawnFeatures}
Expand Down Expand Up @@ -1561,11 +1560,11 @@ MainController.prototype.getUrlVtStyle = function() {
* @param {boolean} active 3d state
*/
MainController.prototype.enable3dCallback_ = function(active) {
// if (!active) {
// this.appMvtStylingService.unpublishIfSerial(this.map_);
// return;
// }
// this.appMvtStylingService.publishIfSerial(this.map_);
if (!active) {
this.appMvtStylingService.unpublishIfSerial(this.map_);
return;
}
this.appMvtStylingService.publishIfSerial(this.map_);

var piwik = /** @type {Piwik} */ (this.window_['_paq']);
if (piwik != undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MvtStylingService {
* @param {ngeo.statemanager.Location} ngeoLocation ngeo location service.
* @ngInject
*/
constructor($http, appUserManager, uploadvtstyleUrl, deletevtstyleUrl, getvtstyleUrl, ngeoBackgroundLayerMgr, ngeoLocation) {
constructor($http, appUserManager, uploadvtstyleUrl, uploadvtstyleUrlOverride, deletevtstyleUrl, deletevtstyleUrlOverride, getvtstyleUrl, vectortilesUrl, ngeoBackgroundLayerMgr, ngeoLocation) {
this.http_ = $http;
this.appUserManager_ = appUserManager;
this.isCustomStyle = false;
Expand All @@ -59,9 +59,10 @@ class MvtStylingService {
topogr_global: false,
topo_bw_jpeg: false
};
this.uploadvtstyleUrl_ = uploadvtstyleUrl;
this.deletevtstyleUrl_ = deletevtstyleUrl;
this.uploadvtstyleUrl_ = uploadvtstyleUrlOverride ? uploadvtstyleUrlOverride : uploadvtstyleUrl;
this.deletevtstyleUrl_ = deletevtstyleUrlOverride ? deletevtstyleUrlOverride : deletevtstyleUrl;
this.getvtstyleUrl_ = getvtstyleUrl;
this.vectortilesUrl_ = vectortilesUrl;
this.backgroundLayerMgr_ = ngeoBackgroundLayerMgr;
this.ngeoLocation_ = ngeoLocation;
this.mapStore_ = useMapStore();
Expand All @@ -81,7 +82,7 @@ class MvtStylingService {
}

createXYZCustom_(id) {
return `https://vectortiles.geoportail.lu/styles/${id}/{z}/{x}/{y}.png`;
return `${this.vectortilesUrl_}/styles/${id}/{z}/{x}/{y}.png`;
}

createRemoteItemKey_(label) {
Expand Down
57 changes: 56 additions & 1 deletion geoportal/geoportailv3_geoportal/views/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def upload_vt_style(self):

for source in data["sources"]:
data["sources"][source]["url"] = data["sources"][source]["url"].replace("https://vectortiles.geoportail.lu/data/", "mbtiles://{").replace(".json", "}")

except:
return {"status":"KO"}
data = json.dumps(data).replace('&gt;', '>' ).replace('&lt;', '<' )
Expand Down Expand Up @@ -72,3 +72,58 @@ def delete_vt_style(self):

return {"status":"OK"}


@view_config(route_name='upload_permalink_style', renderer='json')
def upload_vt_permalink_style(self):
input_file = self.request.POST['style'].file
if 'VT_PERMALINK_DIR' in os.environ:
dir = os.environ['VT_PERMALINK_DIR']
else:
dir = "/tmp"
id = uuid.uuid4()
file_path = os.path.join(dir, '%s.json' %id)

input_file.seek(0)
with open(file_path, 'w') as output_file:
try:
data = json.load(input_file)

except:
return {"status": "KO"}
data = json.dumps(data).replace('&gt;', '>').replace('&lt;', '<')
data = json.loads(data)

json.dump(data, output_file)

return {"status": "OK", "id": str(id)}

@view_config(route_name='get_permalink_style', renderer='json')
def get_vt_permalink_style(self):
# id = self.request.matchdict['id']
id = self.request.params.get("id")
if 'VT_PERMALINK_DIR' in os.environ:
dir = os.environ['VT_PERMALINK_DIR']
else:
dir = "/tmp"

file_path = os.path.join(dir, '%s.json' %id)
if not os.path.exists(file_path):
return HTTPBadRequest("File does not exist")
with open(file_path) as json_file:
data = json.load(json_file)

return data

@view_config(route_name='delete_permalink_style', renderer='json')
def delete_vt_permalink_style(self):
id = self.request.params.get("id")
if 'VT_PERMALINK_DIR' in os.environ:
dir = os.environ['VT_PERMALINK_DIR']
else:
dir = "/tmp"

file_path = os.path.join(dir, '%s.json' %id)
if os.path.exists(file_path):
os.remove(file_path)

return {"status": "OK"}
2 changes: 1 addition & 1 deletion geoportal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "https://github.com/Geoportail-Luxembourg/geoportailv3/issues"
},
"devDependencies": {
"luxembourg-geoportail": "https://github.com/Geoportail-Luxembourg/luxembourg-geoportail.git#ed3d13c8637ac3abc611864033d0c6a3b4586b12",
"luxembourg-geoportail": "https://github.com/Geoportail-Luxembourg/luxembourg-geoportail.git#5bd8755e6592a94883663451de5f4311e260c7b8",
"@babel/core": "7.16.0",
"@babel/plugin-proposal-class-properties": "7.16.0",
"@babel/plugin-proposal-decorators": "7.16.0",
Expand Down
7 changes: 7 additions & 0 deletions geoportal/vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ vars:
tiles3dUrl: https://3dtiles.geoportail.lu/3dtiles/
lidarProfileUrl: '{LIDAR_PROFILE_URL}'
proxyWmsUrl: '{PROXYWMSURL}'
uploadvtstyleUrlOverride: '{UPLOAD_VT_STYLE_URL}'
deletevtstyleUrlOverride: '{DELETE_VT_STYLE_URL}'
geonetworkBaseUrl: '{GEONETWORK_BASE_URL}'
vectortilesUrl: '{VECTORTILESURL}'
wmtsUrl: '{WMTSURL}'
Expand Down Expand Up @@ -246,6 +248,9 @@ vars:
uploadvtstyleUrl: {name: upload_vt_style}
deletevtstyleUrl: {name: delete_vt_style}
getvtstyleUrl: {name: get_vt_style}
uploadvtpermalinkUrl: {name: upload_permalink_style}
deletevtpermalinkUrl: {name: delete_permalink_style}
getvtpermalinkUrl: {name: get_permalink_style}
downloadPdfUrl: {name: download_pdf}
static:
appImagesPath: {name: 'geoportailv3_geoportal:static-ngeo/images/'}
Expand Down Expand Up @@ -524,6 +529,8 @@ runtime_environment:
- {name: PDS_SMTP_SERVER}
- {name: PDS_BCC_ADDRESS}
- {name: PROXYWMSURL, default: 'https://wmsproxy.geoportail.lu/ogcproxywms'}
- {name: UPLOAD_VT_STYLE_URL, default: ''}
- {name: DELETE_VT_STYLE_URL, default: ''}
- {name: REVERSE_GEOCODE_API_KEY, default: ''}
- {name: REVERSE_GEOCODE_URL, default: 'http://open.mapquestapi.com/nominatim/v1/reverse.php'}
- {name: ROUTING_GRAPHHOPPER_API_KEY, default: null}
Expand Down