Hello,
I'm really enjoying the Worldmap node (node-red-contrib-web-worldmap). Great project and lots of options!
I'm hoping someone else has used this node in an "offline" setting, with no access to internet. In its default state the basemaps are sourced through the internet, but my application will be offline. It appears the function to use a local WMS server such as Mapserver would work for this application. Can anyone confirm this, or would the node error when it cannot connect to the other mapping services?
I have been working to setup the Mapserver on the same device as node-red and followed the instructions in the documentation, however I have not been able to get it to work.
I know some of this falls outside of the scope of node-red discussions, but as the two are closely integrated so I'll post both node-red and Mapserver configurations.
I'm thinking the issue may have to do with the directory setup between Worldmap and Mapserver.
The Worldmap configuration and command function to call the local WMS mapserver:
[{"id":"afe96885.6c77b8","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"80dcecf8.e9e818","type":"worldmap","z":"afe96885.6c77b8","name":"","lat":"52","lon":"-115","zoom":"","layer":"Esri Dark Grey","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","path":"/map","x":670,"y":340,"wires":[]},{"id":"2c5f681.ada9818","type":"inject","z":"afe96885.6c77b8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":290,"y":340,"wires":[["fedeaacf.3ce8c"]]},{"id":"fedeaacf.3ce8c","type":"function","z":"afe96885.6c77b8","name":"","func":"msg.payload = { command : { map : {\n    \"name\": \"OSM-BC\",\n    \"url\": \"/cgi-bin/mapserv\",   // we will serve the tiles from this node locally.\n    \"opt\": {\n        \"layers\": \"OSM-BC\",                         // specifies a layer in your map file\n        \"format\": \"image/png\",\n        \"transparent\": true,\n        \"attribution\": \"British Columbia\"\n    },\n    \"wms\": true                                 // set to true for WMS type mapserver\n}}}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":480,"y":340,"wires":[["80dcecf8.e9e818"]]}]
as described in the Worldmap documentation a "mapserv" executable was created and located in ~/.node-red/node_modules/node-red-contrib-web-worldmap/:
#! /bin/sh
# set this to the path of your WMS map file (which in turn points to your tiles)
MS_MAPFILE=/home/pi/maps/BC.map
export MS_MAPFILE
# and set this to the path of your cgi-mapserv executable
/usr/bin/mapserv
This called the mapserver mapfile BC.map as below:
MAP
    CONFIG "MS_ERRORFILE" "/home/pi/.node-red/node_modules/node-red-contrib-web-worldmap/worldmap/tmp/ms_error.txt"
    NAME "OSM-BC"
    STATUS ON
    EXTENT -141.7761 46.41459 -114.049 60.00678
#    UNITS DD
    IMAGECOLOR 255 255 255
    PROJECTION
                "init=epsg:3857"
    END # PROJECTION
    #
    # Start of web interface definition
    #
    WEB
        IMAGEPATH "/home/pi/.node-red/node_modules/node-red-contrib-web-worldmap/worldmap/tmp/"
        IMAGEURL "/map/tmp/"
        METADATA
             "WMS_ENABLE_REQUEST" "*"
        END #METADATA
    END # WEB
    #
    # Start of layer definitions
    #
    LAYER
        NAME  "OSM-BC"
        DATA "/home/pi/maps/OSM/osm-2017-07-03-v3.6.1-canada_british-columbia.mbtiles"
        PROJECTION
           "init=epsg:3857"
        END # PROJECTION
        TYPE RASTER
        STATUS DEFAULT
    END #LAYER
END # MAP
With this mapfile, there are no errors in the mapserver ms_error.txt, the layer is visible as a choice in the worldmap page, but when selected only displays a blank screen. I'm unsure about the WEB image paths as set in the mapfile, should these be a specific location within the node-red directory tree?
    WEB
        IMAGEPATH "/home/pi/.node-red/node_modules/node-red-contrib-web-worldmap/worldmap/tmp/"
        IMAGEURL "/map/tmp/"
If anyone has some working config for this setup using a local Mapserver that would help.
Thanks!