Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#occurrence {
marker-line-width: 0;
marker-allow-overlap: true;
marker-fill: #000000;

[total <= 10] { marker-width: 25; marker-fill: #000; marker-opacity: 1.0; marker-line-color: #000; marker-line-width: 1 }
[total > 10][total <= 100] { marker-width: 28; marker-fill: #000; marker-opacity: 0.8; marker-line-color: #000; marker-line-width: 0 }
[total > 100][total <= 1000] { marker-width: 30; marker-fill: #000; marker-opacity: 0.7; marker-line-color: #000; marker-line-width: 0 }
[total > 1000][total <= 10000] { marker-width: 32; marker-fill: #000; marker-opacity: 0.6; marker-line-color: #000; marker-line-width: 0 }
[total > 10000] { marker-width: 35; marker-fill: #000; marker-opacity: 0.6; marker-line-color: #000; marker-line-width: 0 }
}
11 changes: 11 additions & 0 deletions mapnik-server/src/main/node/cartocss/scaled-circles-thumbnail.mss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#occurrence {
marker-line-width: 0;
marker-allow-overlap: true;
marker-fill: #206EFF;

[total <= 10] { marker-width: 25; marker-fill: #fed976; marker-opacity: 1.0; marker-line-color: #fe9724; marker-line-width: 1 }
[total > 10][total <= 100] { marker-width: 28; marker-fill: #fd8d3c; marker-opacity: 0.8; marker-line-color: #fd5b24; marker-line-width: 0 }
[total > 100][total <= 1000] { marker-width: 30; marker-fill: #fd8d3c; marker-opacity: 0.7; marker-line-color: #fd471d; marker-line-width: 0 }
[total > 1000][total <= 10000] { marker-width: 32; marker-fill: #f03b20; marker-opacity: 0.6; marker-line-color: #f01129; marker-line-width: 0 }
[total > 10000] { marker-width: 35; marker-fill: #bd0026; marker-opacity: 0.6; marker-line-color: #bd0047; marker-line-width: 0 }
}
12 changes: 12 additions & 0 deletions mapnik-server/src/main/node/public/map/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,18 @@ <h2><a href="#">Style overview</a></h2>
</div>
</a>
</li>
<li>
<h2><a href="#">Thumbnail styles</a></h2>
<p>Suitable for very small maps</p>
<a href="thumbnail-styles.html">
<div class="preview">
<img
style="background-image: url(https://tile.gbif.org/4326/omt/0/0/0@1x.png?style=gbif-dark);"
src="./occurrence/density/0/0/0@1x.png?style=scaled.circles.thumbnail&srs=EPSG:4326&bin=hex&hexPerTile=79&taxonKey=797"
/>
</div>
</a>
</li>
</ul>

<h2>Technical debugging</h2>
Expand Down
256 changes: 256 additions & 0 deletions mapnik-server/src/main/node/public/map/thumbnail-styles.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion mapnik-server/src/main/node/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ var assetsHTML = [
'/map/legacy-style-debugging.html',
'/map/pixel-style-debugging.html',
'/map/style-debugging.html',
'/map/styles.html'];
'/map/styles.html',
'/map/thumbnail-styles.html'];

function parseUrl(parsedRequest) {
if (parsedRequest.pathname.endsWith(".png")) {
Expand Down
9 changes: 8 additions & 1 deletion mapnik-server/src/main/node/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ function createServer(config) {
console.log("Retrieved", results.length, "tiles, error", err);
if (!err && results.length == 4) {
writeHeaders(200, results[0].etag, res);
renderer(parameters, results.map(r => r.body), res);
try {
renderer(parameters, results.map(r => r.body), res);
} catch (e) {
// something went wrong
res.writeHead(500, {'Content-Type': 'image/png', 'Access-Control-Allow-Origin': '*', 'X-Error': e.message});
res.end(fs.readFileSync('./public/map/500.png'));
console.log(e);
}
} else {
console.log("Error retrieving four vector tiles", err);
res.writeHead(503, {'Content-Type': 'image/png', 'Access-Control-Allow-Origin': '*', 'X-Error': err.message});
Expand Down
4 changes: 4 additions & 0 deletions mapnik-server/src/main/node/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ namedStyles["orange.marker"] = compileStylesheetSync("./cartocss/orange-marker.m
// Adhoc map style for ES portal (mode=GEO_CENTROID)
namedStyles["scaled.circles"] = compileStylesheetSync("./cartocss/scaled-circles.mss");

// Adhoc map style for thumbnails (mode=GEO_CENTROID)
namedStyles["scaled.circles.thumbnail"] = compileStylesheetSync("./cartocss/scaled-circles-thumbnail.mss");
namedStyles["scaled.circles.thumbnail.black"] = compileStylesheetSync("./cartocss/scaled-circles-thumbnail-black.mss");


// Miscellaneous styles
namedStyles["green2.poly"] = compileStylesheetSync("./cartocss/green2-poly.mss");
Expand Down