Fix leader length to be one minute if speed in m/s

Update readme re docker mapserver hints
This commit is contained in:
Dave Conway-Jones 2021-03-04 11:32:28 +00:00
parent 3a17b73ade
commit f68cee3dce
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
8 changed files with 26 additions and 14 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.8.8 - Change length of speed leader to show where you will be in 1 min if speed in m/s
- v2.8.7 - Delay start of ui widget. - v2.8.7 - Delay start of ui widget.
- v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153 - v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153
- v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier. - v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.8.8 - Change length of speed leader to show where you will be in 1 min if speed in m/s
- v2.8.7 - Delay start of ui widget. - v2.8.7 - Delay start of ui widget.
- v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153 - v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153
- v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier. - v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier.
@ -630,6 +631,12 @@ You can then add a new WMS Base layer by injecting a message like
Optionally set `"wms":"grey"` to set the layer to greyscale which may make your markers more visible. Optionally set `"wms":"grey"` to set the layer to greyscale which may make your markers more visible.
**Hint**: if can use a docker container like https://hub.docker.com/r/geodata/mapserver/ then assuming you have the mapfile 'my-app.map' in the current working directory, you could mount it as:
```
docker run -d --name mapserver -v $(pwd):/maps:ro -p 1881:80 geodata/mapserver
```
then the url should be of the form `"url": "http://localhost:1881/?map=/maps/my-app.map",` where *my-app.map* is the name of your map file. A quick test of the server would be to browse to http://localhost:1881/?map=/maps/my-app.map&mode=map
## Examples and Demo Flow ## Examples and Demo Flow

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-web-worldmap", "name": "node-red-contrib-web-worldmap",
"version": "2.8.7", "version": "2.8.8",
"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": {
"cgi": "0.3.1", "cgi": "0.3.1",

View File

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- <!--
Copyright 2015, 2019 IBM Corp. Copyright 2015, 2021 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,6 +1,6 @@
/* eslint-disable no-inner-declarations */ /* eslint-disable no-inner-declarations */
/** /**
* Copyright 2015, 2019 IBM Corp. * Copyright 2015, 2021 IBM Corp.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,6 +1,6 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<!-- <!--
Copyright 2015, 2019 IBM Corp. Copyright 2015, 2021 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -173,6 +173,7 @@ map.on('load', function() {
if (c === "N") { return "#A4FFA3"; } if (c === "N") { return "#A4FFA3"; }
if (c === "U") { return "#FFFF78"; } if (c === "U") { return "#FFFF78"; }
if (c === "H") { return "#FF7779"; } if (c === "H") { return "#FF7779"; }
if (c === "S") { return "#FF7779"; }
} }
// create the points for the marker and return the geojson // create the points for the marker and return the geojson
@ -182,16 +183,13 @@ map.on('load', function() {
if (p.hasOwnProperty("icon")) { if (p.hasOwnProperty("icon")) {
if (p.icon.indexOf("male") !== -1) { thing = "person"; } if (p.icon.indexOf("male") !== -1) { thing = "person"; }
} }
p.SDIC = p.SIDC || p.sidc;
if (p.hasOwnProperty("SIDC")) { if (p.hasOwnProperty("SIDC")) {
if (p.SIDC.indexOf("SFGPU") !== -1) { thing = "person"; } if (p.SIDC.indexOf("SFGPU") !== -1) { thing = "person"; }
if (p.SIDC.indexOf("SFGPUC") !== -1) { thing = "block"; } if (p.SIDC.indexOf("SFGPUC") !== -1) { thing = "block"; }
if (p.SIDC.indexOf("GPEV") !== -1) { thing = "block"; }
p.iconColor = lookupColor(p.SIDC); p.iconColor = lookupColor(p.SIDC);
} }
if (p.hasOwnProperty("sidc")) {
if (p.sidc.indexOf("SFGPU") !== -1) { thing = "person"; }
if (p.SIDC.indexOf("SFGPUC") !== -1) { thing = "block"; }
p.iconColor = lookupColor(p.sidc);
}
var t = p.type || thing; var t = p.type || thing;
var base = p.height || 0; var base = p.height || 0;
if (t === "person") { tall = 3; } // person slightly tall and thin if (t === "person") { tall = 3; } // person slightly tall and thin
@ -201,6 +199,7 @@ map.on('load', function() {
//console.log({p},{t},{fac},{base},{tall}); //console.log({p},{t},{fac},{base},{tall});
var sin = 1; var sin = 1;
var cos = 0; var cos = 0;
p.hdg = p.hdg || p.heading;
if (p.hasOwnProperty("hdg")) { if (p.hasOwnProperty("hdg")) {
sin = Math.sin((90 - p.hdg) * Math.PI / 180); sin = Math.sin((90 - p.hdg) * Math.PI / 180);
cos = Math.cos((90 - p.hdg) * Math.PI / 180); cos = Math.cos((90 - p.hdg) * Math.PI / 180);

View File

@ -180,14 +180,14 @@ var handleFiles = function(files) {
} }
var readFile = function(file) { var readFile = function(file) {
console.log("FILE",file)
// Check if the file is text or kml // Check if the file is text or kml
if (file.type && if (file.type &&
file.type.indexOf('text') === -1 && file.type.indexOf('text') === -1 &&
file.type.indexOf('kml') === -1 && file.type.indexOf('kml') === -1 &&
file.type.indexOf('jpeg') === -1 && file.type.indexOf('json') === -1 &&
file.type.indexOf('png') === -1 && file.type.indexOf('image/jpeg') === -1 &&
file.type.indexOf('json') === -1) { file.type.indexOf('image/png') === -1 &&
file.type.indexOf('image/tiff') === -1) {
console.log('File is not text, kml, jpeg, png, or json', file.type, file); console.log('File is not text, kml, jpeg, png, or json', file.type, file);
return; return;
} }
@ -220,6 +220,11 @@ var readFile = function(file) {
} }
} }
} }
else if (content.indexOf("image/tiff") !== -1) {
data = atob(content.split("base64,")[1]);
console.log("Geotiff",typeof data)
/// we now have a geotiff image to render...
}
ws.send(JSON.stringify({action:"file", name:file.name, type:file.type, content:content, lat:droplatlng.lat, lon:droplatlng.lng})); ws.send(JSON.stringify({action:"file", name:file.name, type:file.type, content:content, lat:droplatlng.lat, lon:droplatlng.lng}));
} }
else { else {
@ -1815,7 +1820,7 @@ function setMarker(data) {
else if (data.heading !== undefined) { track = data.heading; } else if (data.heading !== undefined) { track = data.heading; }
else if (data.bearing !== undefined) { track = data.bearing; } else if (data.bearing !== undefined) { track = data.bearing; }
if (track != undefined) { // if there is a heading if (track != undefined) { // if there is a heading
if (data.speed != null) { data.length = parseFloat(data.speed || "0") * 50; } // and a speed if (data.speed != null) { data.length = parseFloat(data.speed || "0") * 60; } // and a speed
if (data.length != null) { if (data.length != null) {
if (polygons[data.name] != null && !polygons[data.name].hasOwnProperty("_layers")) { if (polygons[data.name] != null && !polygons[data.name].hasOwnProperty("_layers")) {
map.removeLayer(polygons[data.name]); map.removeLayer(polygons[data.name]);