JOSM / PicLayer

A JOSM plugin to load and transform pictures on a separate layer
https://wiki.openstreetmap.org/wiki/JOSM/Plugins/PicLayer
GNU General Public License v2.0
5 stars 1 forks source link

Relative file path in JOSM session file #6

Open m93a opened 2 months ago

m93a commented 2 months ago

In a session.jos file, the other layers can be specified by paths relative to the session file:

<?xml version="1.0" encoding="utf-8"?>
<josm-session version="0.1">
    <layers active="1">
        <layer index="1" name="data_layer.osm" type="osm-data" version="0.1" visible="true">
            <file>./data.osm</file>
        </layer>
        <layer index="2" name="google_contours.osm" type="osm-data" version="0.1" visible="true">
            <file>./contours.osm</file>
        </layer>
    </layers>
</josm-session>

However, if I try to include a pic layer using a relative path:

<layer index="3" name="p69_001.png" type="piclayerImage" version="0.1" visible="true">
    <piclayerImage>
        <file>./my_pic.png</file>
        <thumbnail>false</thumbnail>
    </piclayerImage>
</layer>

I get an error: image

The only way to get the image to load is by using a full absolute path. This ruins the portability of a session file that would otherwise work across different machines.

m93a commented 2 months ago

This is probably caused by this line:

entry.setFile(new File(attrElem.getTextContent()));

The file path should be resolved relative to the session file.