From 6aaef03c5e6a51340b84b2836963c3a9983cee63 Mon Sep 17 00:00:00 2001 From: Matthew Blissett Date: Mon, 4 Sep 2017 11:56:57 +0200 Subject: [PATCH] User interface. --- server.py | 5 ++++- postserve.html => static/index.html | 0 postserve.js => static/postserve.js | 28 +--------------------------- 3 files changed, 5 insertions(+), 28 deletions(-) rename postserve.html => static/index.html (100%) rename postserve.js => static/postserve.js (74%) diff --git a/server.py b/server.py index db47992..13a6e20 100644 --- a/server.py +++ b/server.py @@ -188,7 +188,10 @@ class GetTile(tornado.web.RequestHandler): def m(): if __name__ == "__main__": # Make this prepared statement from the tm2source - application = tornado.web.Application([(r"/tiles/([0-9]+)_([0-9]+)_([0-9]+).pbf", GetTile)]) + application = tornado.web.Application([ + (r"/tiles/([0-9]+)[/_]([0-9]+)[/_]([0-9]+).pbf", GetTile), + (r"/([^/]*)", tornado.web.StaticFileHandler, {"path": "./static", "default_filename": "index.html"}) + ]) server = tornado.httpserver.HTTPServer(application) server.bind(8080) diff --git a/postserve.html b/static/index.html similarity index 100% rename from postserve.html rename to static/index.html diff --git a/postserve.js b/static/postserve.js similarity index 74% rename from postserve.js rename to static/postserve.js index 6814023..a853e0f 100644 --- a/postserve.js +++ b/static/postserve.js @@ -37,32 +37,6 @@ function createDensityStyle2() { }; } -function createStatsStyle() { - var fill = new ol.style.Fill({color: '#000000'}); - var stroke = new ol.style.Stroke({color: '#000000', width: 1}); - var text = new ol.style.Text({ - text: 'XYXYXY', - fill: fill, - stroke: stroke, - font: '16px "Open Sans", "Arial Unicode MS"' - }); - - - var styles = []; - return function(feature, resolution) { - var length = 0; - //console.log(feature); - text.setText('Occurrences: '+feature.get('total')); - console.log(feature.get('total')); - styles[length++] = new ol.style.Style({ - stroke: new ol.style.Stroke({color: '#000000'}), - text: text - }); - styles.length = length; - return styles; - }; -} - var tileGrid = new ol.tilegrid.TileGrid({ extent: ol.proj.get('EPSG:4326').getExtent(), minZoom: 0, @@ -77,7 +51,7 @@ layers['EPSG:4326'] = new ol.layer.VectorTile({ format: new ol.format.MVT(), tileGrid: tileGrid, tilePixelRatio: 8, - url: 'http://mb.gbif.org:8080/tiles/{z}_{x}_{y}.pbf', + url: '/tiles/{z}_{x}_{y}.pbf', wrapX: false }), style: createStyle(),