dceejay / RedMap

A web map app for Node-RED to put blobs on
Apache License 2.0
110 stars 60 forks source link

PMTiles detected but not displayed when selected. #260

Closed TwinTurbine closed 2 months ago

TwinTurbine commented 9 months ago

Hi,

Having uploaded two custom maps to my Raspberry 2 server running Raspbian Bullseye with Node Red 3.1.3 and node-red-contrib-web-worldmap 4.6.1 I'm having trouble viewing these map in any of the worldmap nodes.

Both the Dashboard as well as the Location node will list the PMTile maps perfectly but from there on they behave a bit differently. The Dashboard Worldmap node will just continue to show the default OSM whereas the Location map switches to a solid, gray background, when any of the custom maps are selected.

I don't think there's any problem with the maps as they are perfectly viewable in the online PMTiles Viewer, but one never knows of course. Below the metadata of one of the files can be seen, if that helps.

root directory: offset=127 len=78 metadata: offset=205 len=157 leaf directories: offset=362 len=89731 tile data: offset=90093 len=1712617545 num addressed tiles: 38133 num tile entries: 38133 num tile contents: 38133 clustered: true internal compression: 2 tile compression: 1 tile type: 2 min zoom: 2 max zoom: 12 min lon, min lat, max lon, max lat: 10.8247509, 55.2757111, 24.9699917, 69.1247384 center zoom: 2 center lon, center lat: 17.8973713, 62.2002247

{ "description": "FK100K_PNG8", "format": "png", "maxzoom": "12", "minzoom": "0", "name": "FK100K PNG8", "type": "OVERLAY", "version": "1.1" }

Kind regards and thanks for a fantastic contribution to Node Red!

dceejay commented 9 months ago

Can you maybe try an extract of a map segment by using the command line pmtiles utility to extract an area from https://docs.protomaps.com/basemaps/downloads ? or try this zipped up World-level5.pmtiles.zip file (unzip first of course) - Note: you may need to zoom out to see anything at this zoom level.

I suspect it may be down to the colours/styling of layers - what is the source of your pmtiles file ?

Also maybe try adding a file pmtiles.opts (into your .node-red dir with something like..

{
    "maxDataZoom": 12,
    "maxZoom": 18,
    "dark": false
}

As the max zoom you have in the data seems to say 12 whereas I think I default to 15.

TwinTurbine commented 9 months ago

Hi again,

I tried World-level5.pmtiles and it seemed to be viewable when zooming out. I also tried the pmtiles.opts but that only made my objects/things that I would like to plot on the map disappear.

The Pmtiles file that I would like to view is originally an MBTiles file generated from a rasterized map. It might be the reason of the problem but I just found it strange the the PMTiles Viewer will render the same file perfectly.

dceejay commented 9 months ago

yeah - so most likely the way the features are coloured, but then again I did think it was a man for vector type maps rather than raster. (but happy to be proven wrong). How large is your map (or a section of it ?) - As in can you send it to me - or point me at a temporary download and I could have a look over the next few days.

Koloblix commented 9 months ago

Have same issue, with an self generated *.PMTile. To work around, I installed tileserver-gl via NPM, then started it via tileserver-gl --file <PATH_TO_PMTILE>. In Node-Red Worldmap set Basemap to "Custom Map Provider" with URL "http://127.0.0.1:8080/data/pmtiles/{z}/{x}/{y}.jpeg". (You have to change to .png if sourcefiles are png.) That workes for me using DOP20 orthographical photos to generate a map.

dceejay commented 9 months ago

Must admit I thought tileserver-gl worked with mbtiles rather than pmtiles - but maybe it does both... nice if it does.

(just checked - as YES IT DOES ! - that is nice - yes tileserver is indeed easy to setup as well - and would also be running as a separate thread so a good option in my book.)

Rajduino commented 8 months ago

I just started exploring the offline maps on node-red using this world map plugin. I am also facing the same problem. As I understand, there can be multiple random named overlays in .pmtiles files as it should. Is there any way to choose between those overlays? I am not getting the options to select between them automatically after the .pmtiles is detected by node-red. Can I in any way pass the name of the overlays to select using any msg.payload command? Also none of the layers are visible from the .pmtiles file according to my exploration. Thank You.

TwinTurbine commented 8 months ago

The PMTile file I tried to use within Worldmap was generated from an MBTiles file using the PMTile CLI. As I mentioned earlier it was therafter perfectly rendered using the PMTiles Viewer. So it seems to me that the PMTiles format does support raster MBTiles. Since then I've tried the Tileserver-GL and that works great as an alternative. I only have to dig a little bit deeper into the software in order to be able to serve different maps (scales) for different zoom levels. It would be nice if the Worldmap plugin could be made to serve raster PMTiles as I really like the possibility to switch between different maps in an easy way. AFAIK it's only possible to connect one custom map source to Worldmap.

dceejay commented 8 months ago

You can only configure one source in the config page - but you can inject other new layers with sources at startup time if you need.

TwinTurbine commented 8 months ago

Thanks for the tip, still learing as you can understand. Injecting several layers works great so that covers my needs. Just one question regarding that: Is it possible to add several layers without activating them all at the same time?

TwinTurbine commented 8 months ago

Sorry, found the solution to my last question in the documentation.