JOSM PicLayer-plugin extremely slow

I’m currently using the pic-layer-plugin excessively with JOSM, but when I open .tif files it’s getting ridiculously slow, even worse than with .jpg files. I’m using a EPSG 25832 map projection, which already adds some render delay to regular imagery. My machine is a Ryzen 9 5900X with 64 GB of RAM, if it’s somehow related to that.

Is there any way to speed this up? Everything in JOSM is creeping now, not only moving the map, but also drawing on it. It’s like everything has 2FPS, it’s hardly usable at all.

Have you tried to increase the Java max heap size already? (Java parameter -Xmx)

How to assign more memory to JOSM? - again / Editors / OpenStreetMap Forum

Yes, up to 32GB. It didn’t affect the speed at all, just how many pictures I was able to open.

I found the piclayer plugin much slower than tiles when I tried to use it. You also can’t adjust to match GPS traces etc. For me the solution was to render the parts of the image I was interested in out to tiles with QMetatikls in QGIS and reference those from JOSM.

How do you show these exported tiles in JOSM? It’s just PNGs, not WMS/TMS/WMTS or MVT. Any documentation whatsoever would be helpful

TBH, I’d probably import the image into something like GeoServer, and use that instead of trying to load the image into JOSM.

Based off of my profiling, it looks like it is due to the Java2D pipeline making a copy of the image in memory every time it paints the image. This is a two-fold performance hit: first, when making the copy, and second when GC has to pause the JVM to clean up the copy in memory.

In order to fix this, we would have to rewrite the piclayer plugin to tile the image. This would not be a small task.

I don’t know how many people use the PicLayer plugin, so I don’t know if it is worth it to spend the time trying to fix the performance, especially when there is software that is specifically made for serving imagery.

Oh yes, that is already much better. However, the images aren’t pre-generated, so moving around is still slow. Is there a way to have GeoServer pre-fill the tiling cache?

1 Like

There is a way to precache tiles, but it shouldn’t slow down moving around in JOSM (unless you are waiting for the images to load).

Take a look at GeoWebCache — GeoServer 2.23.x User Manual for more information. Tile Layers is probably the right page.

1 Like

Yes, this is the problem. But I suppose that’s not a problem after using the server for a bit, it was just initially. Pre-filling the cache somehow doesn’t work for me - no worker spawned. Well … whatever. That’s already so much better than piclayer! Thanks!

You can create an MBtiles file from QGIS (Processing menu, Generate XYZ tiles in MBtiles format.

1 Like

I’m not sure if it is documented but you can reference local file paths in JOSM custom imagery layers with the relevant URL prefix as you would use to browse to that file in e.g. Chrome (at least you can on Windows, YMMV).

Just point JOSM at the top level folder for the tiles as if it’s a TMS source and it will fetch them. Any missing files will cause an error but you can just render that bit again and get right click to load error tiles.

It helps to set the max and min zooms for the layer to what you have actually rendered. If I know what zoom I will be mapping at I just render that level, zoom to it, and untick to option to autozoom map tiles on the right click menu. There are limits to how much JOSM will let you zoom out from the correct zoom level but it can be quite handy.

Are you able to tweak alignment on mbtiles as for normal tile layers?

How to use the mbtile file in JOSM?

1 Like

There is a JOSM plugin for mbtiles.


This is very useful and actually solves my issue art the moment. Thanks a lot.