Load pmtiles from userdir rather than node_modules to survive an upgrade
Bump to 4.5.0
This commit is contained in:
parent
eb012fee7a
commit
b881ca0f30
@ -1,5 +1,6 @@
|
|||||||
### Change Log for Node-RED Worldmap
|
### Change Log for Node-RED Worldmap
|
||||||
|
|
||||||
|
- v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
|
||||||
- v4.4.0 - Add quad(copter) drone icon.
|
- v4.4.0 - Add quad(copter) drone icon.
|
||||||
- v4.3.3 - Fix for objects changing layers.
|
- v4.3.3 - Fix for objects changing layers.
|
||||||
- v4.3.2 - Fix geojson popup missing label name.
|
- v4.3.2 - Fix geojson popup missing label name.
|
||||||
|
@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
|
|||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
|
- v4.5.0 - Fix pmtiles to look for maps in userdir rather than modules
|
||||||
- v4.4.0 - Add quad(copter) drone icon.
|
- v4.4.0 - Add quad(copter) drone icon.
|
||||||
- v4.3.3 - Fix for objects changing layers.
|
- v4.3.3 - Fix for objects changing layers.
|
||||||
- v4.3.2 - Fix geojson popup missing label name.
|
- v4.3.2 - Fix geojson popup missing label name.
|
||||||
@ -720,7 +721,7 @@ You can use a PMtiles format map archive file from [Protomaps](https://docs.prot
|
|||||||
|
|
||||||
**Note**: the whole planet file is over 100GB so be warned both for local storage and your download speed. You can download or extract just a portion of it if you use the **pmtiles** command line with the extract option. Use `pmtiles extract --help` to see the options.
|
**Note**: the whole planet file is over 100GB so be warned both for local storage and your download speed. You can download or extract just a portion of it if you use the **pmtiles** command line with the extract option. Use `pmtiles extract --help` to see the options.
|
||||||
|
|
||||||
Copy, or create an alias to, your .pmtiles file(s) into your `~/.node-red/node_modules/node-red-contrib-web-worldmap/worldmap/` directory. On re-starting Node-RED the node will detect the file(s) and add them to the base map layer menu, using the file name as the layer name.
|
Copy your .pmtiles file(s) into your `~/.node-red` user directory. On re-starting Node-RED the node will detect the file(s) and add them to the base map layer menu, using the file name as the layer name.
|
||||||
|
|
||||||
### Using a Docker Map Server
|
### Using a Docker Map Server
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-web-worldmap",
|
"name": "node-red-contrib-web-worldmap",
|
||||||
"version": "4.4.0",
|
"version": "4.5.0",
|
||||||
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@turf/bezier-spline": "~6.5.0",
|
"@turf/bezier-spline": "~6.5.0",
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<script type="text/html" data-template-name="worldmap">
|
<script type="text/html" data-template-name="worldmap">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
||||||
|
<input type="text" id="node-input-name" placeholder="name">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<table border="0" width="96%">
|
<table border="0" width="96%">
|
||||||
<tr><td width="100px"><i class="fa fa-globe"></i> Start<td>Latitude</td><td>Longitude</td><td width="60px">Zoom</td></tr>
|
<tr><td width="100px"><i class="fa fa-globe"></i> Start<td>Latitude</td><td>Longitude</td><td width="60px">Zoom</td></tr>
|
||||||
@ -108,10 +112,6 @@
|
|||||||
<option value="true">Enable</option>
|
<option value="true">Enable</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
|
||||||
<input type="text" id="node-input-name" placeholder="name">
|
|
||||||
</div>
|
|
||||||
<div class="form-tips">Set <i>Cluster when</i> to 0 to disable clustering of points.<br/>
|
<div class="form-tips">Set <i>Cluster when</i> to 0 to disable clustering of points.<br/>
|
||||||
If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the map in a new tab.</div>
|
If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the map in a new tab.</div>
|
||||||
</script>
|
</script>
|
||||||
@ -155,6 +155,10 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/html" data-template-name="ui_worldmap">
|
<script type="text/html" data-template-name="ui_worldmap">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
||||||
|
<input type="text" id="node-input-name" placeholder="name">
|
||||||
|
</div>
|
||||||
<div class="form-row" id="template-row-group">
|
<div class="form-row" id="template-row-group">
|
||||||
<label for="node-input-group"><i class="fa fa-table"></i> Group</span></label>
|
<label for="node-input-group"><i class="fa fa-table"></i> Group</span></label>
|
||||||
<input type="text" id="node-input-group">
|
<input type="text" id="node-input-group">
|
||||||
@ -274,10 +278,6 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|||||||
<option value="true">Enable</option>
|
<option value="true">Enable</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
|
||||||
<input type="text" id="node-input-name" placeholder="name">
|
|
||||||
</div>
|
|
||||||
<div class="form-tips">Set <i>Cluster when</i> to 0 to disable clustering of points.<br/>
|
<div class="form-tips">Set <i>Cluster when</i> to 0 to disable clustering of points.<br/>
|
||||||
If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the map in a new tab.</div>
|
If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the map in a new tab.</div>
|
||||||
</script>
|
</script>
|
||||||
@ -593,6 +593,10 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/html" data-template-name="worldmap in">
|
<script type="text/html" data-template-name="worldmap in">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
||||||
|
<input type="text" id="node-input-name" placeholder="name">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-path"><i class="fa fa-globe"></i> Web Path</label>
|
<label for="node-input-path"><i class="fa fa-globe"></i> Web Path</label>
|
||||||
<input type="text" id="node-input-path" placeholder="worldmap">
|
<input type="text" id="node-input-path" placeholder="worldmap">
|
||||||
@ -601,10 +605,6 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|||||||
<label for="node-input-events"><i class="fa fa-sign-out"></i> Events</label>
|
<label for="node-input-events"><i class="fa fa-sign-out"></i> Events</label>
|
||||||
<input type="text" id="node-input-events" placeholder="select events">
|
<input type="text" id="node-input-events" placeholder="select events">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
|
||||||
<input type="text" id="node-input-name" placeholder="name">
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="worldmap in">
|
<script type="text/html" data-help-name="worldmap in">
|
||||||
@ -679,6 +679,10 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/html" data-template-name="worldmap-tracks">
|
<script type="text/html" data-template-name="worldmap-tracks">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
||||||
|
<input type="text" id="node-input-name" placeholder="name">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-depth"><i class="fa fa-map-marker"></i> Number of</label>
|
<label for="node-input-depth"><i class="fa fa-map-marker"></i> Number of</label>
|
||||||
points in track <input type="text" id="node-input-depth" style="width:50%" placeholder="number - default 20">
|
points in track <input type="text" id="node-input-depth" style="width:50%" placeholder="number - default 20">
|
||||||
@ -696,10 +700,6 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|||||||
<input type="checkbox" id="node-input-smooth" style="display:inline-block; width:auto; vertical-align:top;">
|
<input type="checkbox" id="node-input-smooth" style="display:inline-block; width:auto; vertical-align:top;">
|
||||||
<label for="node-input-smooth" style="width:70%;">Smooth tracks using bezier curves.</label>
|
<label for="node-input-smooth" style="width:70%;">Smooth tracks using bezier curves.</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
|
||||||
<input type="text" id="node-input-name" placeholder="name">
|
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="worldmap-tracks">
|
<script type="text/html" data-help-name="worldmap-tracks">
|
||||||
@ -739,14 +739,14 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/html" data-template-name="worldmap-hull">
|
<script type="text/html" data-template-name="worldmap-hull">
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-prop"><i class="fa fa-ellipsis-h"></i> Property</label>
|
|
||||||
<input type="text" id="node-input-prop" placeholder="payload property to group">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
<label for="node-input-name"><i class="fa fa-file"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="name">
|
<input type="text" id="node-input-name" placeholder="name">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-prop"><i class="fa fa-ellipsis-h"></i> Property</label>
|
||||||
|
<input type="text" id="node-input-prop" placeholder="payload property to group">
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/html" data-help-name="worldmap-hull">
|
<script type="text/html" data-help-name="worldmap-hull">
|
||||||
|
10
worldmap.js
10
worldmap.js
@ -13,7 +13,8 @@ module.exports = function(RED) {
|
|||||||
if (fs.existsSync((__dirname + '/mapserv'))) {
|
if (fs.existsSync((__dirname + '/mapserv'))) {
|
||||||
RED.httpNode.use("/cgi-bin/mapserv", require('cgi')(__dirname + '/mapserv'));
|
RED.httpNode.use("/cgi-bin/mapserv", require('cgi')(__dirname + '/mapserv'));
|
||||||
}
|
}
|
||||||
var pmtiles = fs.readdirSync(__dirname + '/worldmap').filter(fn => fn.endsWith('.pmtiles'));
|
//var pmtiles = fs.readdirSync(__dirname + '/worldmap').filter(fn => fn.endsWith('.pmtiles'));
|
||||||
|
var pmtiles = fs.readdirSync(RED.settings.userDir).filter(fn => fn.endsWith('.pmtiles'));
|
||||||
|
|
||||||
function worldMap(node, n) {
|
function worldMap(node, n) {
|
||||||
var allPoints = {};
|
var allPoints = {};
|
||||||
@ -121,8 +122,15 @@ module.exports = function(RED) {
|
|||||||
//console.log("INIT",c)
|
//console.log("INIT",c)
|
||||||
client.write(JSON.stringify({command:c}));
|
client.write(JSON.stringify({command:c}));
|
||||||
for (var p=0; p<pmtiles.length; p++) {
|
for (var p=0; p<pmtiles.length; p++) {
|
||||||
|
fs.symlink(RED.settings.userDir+'/'+pmtiles[p], __dirname+'/worldmap/'+pmtiles[p], 'file', (err) => {
|
||||||
|
if (err) {
|
||||||
|
if (err.code !== "EEXIST") { console.log(err); }
|
||||||
|
}
|
||||||
|
else {
|
||||||
client.write(JSON.stringify({command: {map: {name:pmtiles[p].split('.')[0], pmtiles:pmtiles[p] }}}));
|
client.write(JSON.stringify({command: {map: {name:pmtiles[p].split('.')[0], pmtiles:pmtiles[p] }}}));
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
var o = Object.values(allPoints);
|
var o = Object.values(allPoints);
|
||||||
o.map(v => delete v.tout);
|
o.map(v => delete v.tout);
|
||||||
setTimeout(function() { client.write(JSON.stringify(o)) }, 250);
|
setTimeout(function() { client.write(JSON.stringify(o)) }, 250);
|
||||||
|
Loading…
Reference in New Issue
Block a user