@acalcutt/maplibre-gl-native-test 5.2.1-pre.2 → 5.2.1-pre.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  [![MapLibre Logo](https://maplibre.org/img/maplibre-logo-big.svg)](https://maplibre.org/)
2
2
 
3
- # MapLibre GL Native
3
+ # MapLibre Native
4
4
 
5
- MapLibre GL Native is a free and open-source library for publishing maps in your apps and desktop applications on various platforms. Fast displaying of maps is possible thanks to GPU-accelerated vector tile rendering.
5
+ MapLibre Native is a free and open-source library for publishing maps in your apps and desktop applications on various platforms. Fast displaying of maps is possible thanks to GPU-accelerated vector tile rendering.
6
6
 
7
7
  This project originated as a fork of Mapbox GL Native, before their switch to a non-OSS license in December 2020. For more information, see: [`FORK.md`](./FORK.md).
8
8
 
@@ -12,22 +12,22 @@ This project originated as a fork of Mapbox GL Native, before their switch to a
12
12
 
13
13
  ## Getting Started
14
14
 
15
- To get started with MapLibre GL Native, go to your platform below.
15
+ To get started with MapLibre Native, go to your platform below.
16
16
 
17
17
  ## Documentation
18
18
 
19
- The documentation of MapLibre GL Native is a work in progress. To get an architectural overview and to learn about the current state of the project and its path forward read the [MapLibre GL Native Markdown Book](https://maplibre.org/maplibre-gl-native/docs/book/). See below for platform-specific documentation.
19
+ The documentation of MapLibre Native is a work in progress. To get an architectural overview and to learn about the current state of the project and its path forward read the [MapLibre Native Markdown Book](https://maplibre.org/maplibre-native/docs/book/). See below for platform-specific documentation.
20
20
 
21
21
  ## Platforms
22
22
 
23
- - [⭐️ Android](platform/android/README.md)
24
- - [⭐️ iOS](platform/ios/platform/ios/README.md)
23
+ - [⭐️ Android](platform/android/README.md)
24
+ - [⭐️ iOS](platform/ios/README.md)
25
25
  - [GLFW](platform/glfw)
26
26
  - [Linux](platform/linux/README.md)
27
27
  - [Node.js](platform/node/README.md)
28
28
  - [Qt](platform/qt/README.md)
29
29
  - [Windows](platform/windows/README.md)
30
- - [macOS](platform/ios/platform/macos/README.md)
30
+ - [macOS](platform/macos/README.md)
31
31
 
32
32
  Platforms with a ⭐️ are **MapLibre Core Projects** and have a substantial amount of financial resources allocated to them. Learn about the different [project tiers](https://github.com/maplibre/maplibre/blob/main/PROJECT_TIERS.md#project-tiers).
33
33
 
@@ -35,20 +35,20 @@ Platforms with a ⭐️ are **MapLibre Core Projects** and have a substantial am
35
35
 
36
36
  ![image-metal](https://user-images.githubusercontent.com/53421382/214308933-66cd4efb-b5a5-4de3-b4b4-7ed59045a1c3.png)
37
37
 
38
- MapLibre GL Native is being actively developed. Our big goal for 2023 is to modularize the OpenGL renderer and implement a Metal graphics backend (https://developer.apple.com/metal/). This will improve the performance and yield lower power consumption on iOS devices. At the same time, the Metal preparations will help us in the implementation of a Vulkan graphics backend.
38
+ MapLibre Native is being actively developed. Our big goal for 2023 is to modularize the OpenGL renderer and implement a Metal graphics backend (https://developer.apple.com/metal/). This will improve the performance and yield lower power consumption on iOS devices. At the same time, the Metal preparations will help us in the implementation of a Vulkan graphics backend.
39
39
 
40
40
  Your help in preparing the codebase for the latest graphics backends is more than welcome. Feel free to reach out if you are interested in joining the effort!
41
41
 
42
42
  - Check out the [news](https://maplibre.org/news/) on MapLibre's website.
43
- - See the [Design Proposals](https://github.com/louwers/maplibre-gl-native/tree/main/design-proposals) that have been accepted and are being worked on, the most recent ones being the [Rendering Modularization Design Proposal](design-proposals/2022-10-27-rendering-modularization.md) and the [Metal Port Design Proposal](design-proposals/2022-11-29-metal-port.md).
43
+ - See the [Design Proposals](https://github.com/maplibre/maplibre-native/tree/main/design-proposals) that have been accepted and are being worked on, the most recent ones being the [Rendering Modularization Design Proposal](design-proposals/2022-10-27-rendering-modularization.md) and the [Metal Port Design Proposal](design-proposals/2022-11-29-metal-port.md).
44
44
 
45
45
  ## Contributing
46
46
 
47
- To contribute to MapLibre GL Native, see [`CONTRIBUTING.md`](CONTRIBUTING.md) and (if applicable) the specific instructions for the platform you want to contribute to.
47
+ To contribute to MapLibre Native, see [`CONTRIBUTING.md`](CONTRIBUTING.md) and (if applicable) the specific instructions for the platform you want to contribute to.
48
48
 
49
49
  ### Getting Involved
50
50
 
51
- Join the `#maplibre-native` Slack channel at OSMUS. Get an invite at https://slack.openstreetmap.us/
51
+ Join the `#maplibre-native` Slack channel at OSMUS. Get an invite at https://slack.openstreetmap.us/
52
52
 
53
53
  ### Bounties 💰
54
54
 
@@ -62,16 +62,15 @@ Read more about the MapLibre Sponsorship Program at [https://maplibre.org/sponso
62
62
 
63
63
  Platinum:
64
64
 
65
- <img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"/>
66
-
65
+ <a href="https://aws.com"><img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"/></a>
67
66
 
68
67
  Silver:
69
68
 
70
- <img src="https://maplibre.org/img/meta-logo.svg" alt="Logo Meta" width="50%"/>
69
+ <a href="https://meta.com"><img src="https://maplibre.org/img/meta-logo.svg" alt="Logo Meta" width="25%"/></a>
71
70
 
72
- Stone:
71
+ <a href="https://www.mierune.co.jp/?lang=en"><img src="https://maplibre.org/img/mierune-logo.svg" alt="Logo MIERUNE" width="25%"/></a>
73
72
 
74
- [MIERUNE Inc.](https://www.mierune.co.jp/?lang=en)
73
+ <a href="https://komoot.com/"><img src="https://maplibre.org/img/komoot-logo.svg" alt="Logo komoot" width="25%"/></a>
75
74
 
76
75
  Backers and Supporters:
77
76
 
@@ -79,4 +78,4 @@ Backers and Supporters:
79
78
 
80
79
  ## License
81
80
 
82
- **MapLibre GL Native** is licensed under the [BSD 2-Clause License](./LICENSE.md).
81
+ **MapLibre Native** is licensed under the [BSD 2-Clause License](./LICENSE.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acalcutt/maplibre-gl-native-test",
3
- "version": "5.2.1-pre.2",
3
+ "version": "5.2.1-pre.7",
4
4
  "description": "Renders map tiles with Maplibre GL",
5
5
  "keywords": [
6
6
  "maplibre",
@@ -17,11 +17,11 @@
17
17
  "types": "platform/node/index.d.ts",
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git+https://github.com/wifidb/maplibre-gl-native.git"
20
+ "url": "git+https://github.com/wifidb/maplibre-native.git"
21
21
  },
22
22
  "license": "BSD-2-Clause",
23
23
  "dependencies": {
24
- "@acalcutt/node-pre-gyp": "^1.0.11",
24
+ "@acalcutt/node-pre-gyp": "^1.0.14",
25
25
  "@acalcutt/node-pre-gyp-github": "1.4.8",
26
26
  "minimatch": "^7.2.0",
27
27
  "npm-run-all": "^4.0.2"
@@ -31,6 +31,7 @@
31
31
  "@mapbox/mvt-fixtures": "3.10.0",
32
32
  "@octokit/plugin-retry": "^4.1.2",
33
33
  "@octokit/rest": "^19.0.7",
34
+ "argparse": "^2.0.1",
34
35
  "aws-sdk": "^2.1318.0",
35
36
  "csscolorparser": "~1.0.2",
36
37
  "d3-queue": "3.0.7",
@@ -66,9 +67,9 @@
66
67
  },
67
68
  "gypfile": true,
68
69
  "binary": {
69
- "module_name": "mbgl",
70
+ "module_name": "mln",
70
71
  "module_path": "./lib/{node_abi}",
71
- "host": "https://github.com/wifidb/maplibre-gl-native/releases/download/",
72
+ "host": "https://github.com/wifidb/maplibre-native/releases/download/",
72
73
  "remote_path": "node-v{version}",
73
74
  "package_name": "{node_abi}-{platform}-{arch}-{configuration}.tar.gz"
74
75
  }
@@ -1,7 +1,7 @@
1
1
  # @maplibre/maplibre-gl-native
2
2
 
3
3
  [![Version](https://img.shields.io/npm/v/@maplibre/maplibre-gl-native?style=flat)](https://www.npmjs.com/package/@maplibre/maplibre-gl-native)
4
- [![node-ci](https://github.com/maplibre/maplibre-gl-native/actions/workflows/node-ci.yml/badge.svg)](https://github.com/maplibre/maplibre-gl-native/actions/workflows/node-ci.yml)
4
+ [![node-ci](https://github.com/maplibre/maplibre-native/actions/workflows/node-ci.yml/badge.svg)](https://github.com/maplibre/maplibre-native/actions/workflows/node-ci.yml)
5
5
 
6
6
  ## Installing
7
7
 
@@ -19,17 +19,48 @@ Run:
19
19
  npm install @maplibre/maplibre-gl-native
20
20
  ```
21
21
 
22
- Further platforms might work [with additional libraries installed](https://github.com/maplibre/maplibre-gl-native/tree/main/platform/linux#prerequisites).
22
+ Further platforms might work [with additional libraries installed](https://github.com/maplibre/maplibre-native/tree/main/platform/linux#prerequisites).
23
23
 
24
24
  ## Testing
25
25
 
26
26
  ```
27
27
  npm test
28
- npm run test-suite
29
28
  ```
30
29
 
31
30
  ## Rendering a map tile
32
31
 
32
+ The minimal example requires only the instantiation of the `mbgl.Map` object, loading a style and calling the `map.render` method:
33
+
34
+ ```js
35
+ var mbgl = require('@maplibre/maplibre-gl-native');
36
+ var sharp = require('sharp');
37
+
38
+ var map = new mbgl.Map();
39
+
40
+ map.load(require('./test/fixtures/style.json'));
41
+
42
+ map.render(function(err, buffer) {
43
+ if (err) throw err;
44
+
45
+ map.release();
46
+
47
+ var image = sharp(buffer, {
48
+ raw: {
49
+ width: 512,
50
+ height: 512,
51
+ channels: 4
52
+ }
53
+ });
54
+
55
+ // Convert raw image buffer to PNG
56
+ image.toFile('image.png', function(err) {
57
+ if (err) throw err;
58
+ });
59
+ });
60
+ ```
61
+
62
+ But you can customize the map providing an options object to `mbgl.Map` constructor and to `map.render` method:
63
+
33
64
  ```js
34
65
  var fs = require('fs');
35
66
  var path = require('path');
@@ -87,7 +118,7 @@ When you are finished using a map object, you can call `map.release()` to perman
87
118
 
88
119
  ## Implementing a file source
89
120
 
90
- When creating a `Map`, you must pass an options object (with a required `request` method and optional 'ratio' number) as the first parameter.
121
+ When creating a `Map`, you can optionally pass an options object (with an optional `request` method and optional `ratio` number) as the first parameter. The `request()` method handles a request for a resource. The `ratio` sets the scale at which the map will render tiles, such as `2.0` for rendering images for high pixel density displays:
91
122
 
92
123
  ```js
93
124
  var map = new mbgl.Map({
@@ -98,7 +129,7 @@ var map = new mbgl.Map({
98
129
  });
99
130
  ```
100
131
 
101
- The `request()` method handles a request for a resource. The `ratio` sets the scale at which the map will render tiles, such as `2.0` for rendering images for high pixel density displays. The `req` parameter has two properties:
132
+ If you omit the `request` method, the `map` object will use the default internal request handlers, which is ok for most cases. However, if you have specific needs, you can implement your own `request` handler. When a `request` method is provided, all `map` resources will be requested by calling the `request` method with two parameters, called `req` and `callback` respectively in this example. The `req` parameter has two properties:
102
133
 
103
134
  ```json
104
135
  {
@@ -107,7 +138,7 @@ The `request()` method handles a request for a resource. The `ratio` sets the sc
107
138
  }
108
139
  ```
109
140
 
110
- The `kind` is an enum and defined in [`mbgl.Resource`](https://github.com/maplibre/maplibre-gl-native/blob/main/include/mbgl/storage/resource.hpp):
141
+ The `kind` is an enum and defined in [`mbgl.Resource`](https://github.com/maplibre/maplibre-native/blob/main/include/mbgl/storage/resource.hpp):
111
142
 
112
143
  ```json
113
144
  {
@@ -123,7 +154,18 @@ The `kind` is an enum and defined in [`mbgl.Resource`](https://github.com/maplib
123
154
 
124
155
  The `kind` enum has no significance for anything but serves as a hint to your implemention as to what sort of resource to expect. E.g., your implementation could choose caching strategies based on the expected file type.
125
156
 
126
- The `request` implementation should pass uncompressed data to `callback`. If you are downloading assets from a source that applies gzip transport encoding, the implementation must decompress the results before passing them on.
157
+ The `callback` parameter is a function that must be called with two parameters: an error message (if there are no errors, then you must pass `null`), and a response object:
158
+
159
+ ```js
160
+ {
161
+ data: {data}, // required, must be a byte array, usually a Buffer object
162
+ modified: {modified}, // Date, optional
163
+ expires: {expires}, // Date, optional
164
+ etag: {etag} // string, optional
165
+ }
166
+ ```
167
+
168
+ If there is no data to be sent to the `callback` (empty data, or `no-content` respose), then it must be called without parameters. The `request` implementation should pass uncompressed data to `callback`. If you are downloading assets from a source that applies gzip transport encoding, the implementation must decompress the results before passing them on.
127
169
 
128
170
  A sample implementation that reads files from disk would look like the following:
129
171
 
@@ -187,7 +229,7 @@ Stylesheets are free to use any protocols, but your implementation of `request`
187
229
 
188
230
  ## Listening for log events
189
231
 
190
- The module imported with `require('maplibre-gl-native')` inherits from [`EventEmitter`](https://nodejs.org/api/events.html), and the `NodeLogObserver` will push log events to this. Log messages can have [`class`](https://github.com/maplibre/maplibre-gl-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L43-L60), [`severity`](https://github.com/maplibre/maplibre-gl-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L17-L23), `code` ([HTTP status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)), and `text` parameters.
232
+ The module imported with `require('maplibre-gl-native')` inherits from [`EventEmitter`](https://nodejs.org/api/events.html), and the `NodeLogObserver` will push log events to this. Log messages can have [`class`](https://github.com/maplibre/maplibre-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L43-L60), [`severity`](https://github.com/maplibre/maplibre-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L17-L23), `code` ([HTTP status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)), and `text` parameters.
191
233
 
192
234
  ```js
193
235
  var mbgl = require('@maplibre/maplibre-gl-native');