forked from mapnik/node-mapnik
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
104 lines (98 loc) · 3.06 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html>
<head>
<title>Node Mapnik</title>
<link href="http://mapnik.org/css/mapnik.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/highlight.min.js"></script>
<style>
section {
padding: 3em 1em;
margin-bottom: 2em;
}
.container {
display: block;
margin: auto;
max-width: 50em;
padding: 0 1em;
}
.header {
width: 100%;
background-image: linear-gradient( #9AD8DD, #45ACB6 );
background-color: white;
color: white;
padding: 5em 0;
}
.left {
width: 75%;
float: left;
}
.right {
width: 21.5%;
float: right;
}
pre {
padding: 0;
width: 100%;
}
h2 {
margin-top: 1.5em;
}
.footer {
text-align: center;
}
</style>
</head>
<body>
<section class="header">
<div class="container clearfix">
<h1>Node Mapnik</h1>
<p>Provides a set of bindings to Mapnik for Node.js</p>
<a class="github-button" href="https://github.com/mapnik/node-mapnik" data-icon="octicon-star" data-style="mega" data-count-href="/mapnik/node-mapnik/stargazers" data-count-api="/repos/mapnik/node-mapnik#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star mapnik/node-mapnik on GitHub">Star</a>
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
</div>
</section>
<section class="container clearfix">
<div class="left">
<p>Node Mapnik is based on Mapnik, a C++ library created for rendering images and vector tiles from custom geographic data sources.</p>
<p>Current version: <strong id="version">3.5.0</strong></p>
<h2>Installation</h2>
<p>Node Mapnik is registered in npm as a module. You can install it with the following command.</p>
<pre><code class="bash">npm install --save mapnik</code></pre>
<h2>Usage</h2>
<p>Render a map from a stylesheet:</p>
<pre><code class="javascript">var mapnik = require('mapnik');
var fs = require('fs');
// register fonts and datasource plugins
mapnik.register_default_fonts();
mapnik.register_default_input_plugins();
var map = new mapnik.Map(256, 256);
map.load('./test/stylesheet.xml', function(err,map) {
if (err) throw err;
map.zoomAll();
var im = new mapnik.Image(256, 256);
map.render(im, function(err,im) {
if (err) throw err;
im.encode('png', function(err,buffer) {
if (err) throw err;
fs.writeFile('map.png',buffer, function(err) {
if (err) throw err;
console.log('saved map image to map.png');
});
});
});
});
</code></pre>
</div>
<div class="right">
<h3>API Reference</h3>
<a class="btn btn-primary" href="/node-mapnik/documentation/3.5">3.5 (latest)</a><br>
<a class="btn btn-outline" href="/node-mapnik/documentation/3.4">3.4</a>
</div>
</section>
<section class="footer">
<p>Copyright © 2016 Artem Pavlenko | <a href="/">Mapnik.org</a></p>
</section>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>