User interface.

This commit is contained in:
Matthew Blissett 2017-09-04 11:56:57 +02:00
parent 3a4b3b4408
commit 6aaef03c5e
3 changed files with 5 additions and 28 deletions

View File

@ -188,7 +188,10 @@ class GetTile(tornado.web.RequestHandler):
def m(): def m():
if __name__ == "__main__": if __name__ == "__main__":
# Make this prepared statement from the tm2source # 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 = tornado.httpserver.HTTPServer(application)
server.bind(8080) server.bind(8080)

View File

@ -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({ var tileGrid = new ol.tilegrid.TileGrid({
extent: ol.proj.get('EPSG:4326').getExtent(), extent: ol.proj.get('EPSG:4326').getExtent(),
minZoom: 0, minZoom: 0,
@ -77,7 +51,7 @@ layers['EPSG:4326'] = new ol.layer.VectorTile({
format: new ol.format.MVT(), format: new ol.format.MVT(),
tileGrid: tileGrid, tileGrid: tileGrid,
tilePixelRatio: 8, tilePixelRatio: 8,
url: 'http://mb.gbif.org:8080/tiles/{z}_{x}_{y}.pbf', url: '/tiles/{z}_{x}_{y}.pbf',
wrapX: false wrapX: false
}), }),
style: createStyle(), style: createStyle(),