Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Style: Icon path relative to style file #1463

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments
Closed

Style: Icon path relative to style file #1463

openstreetmap-trac opened this issue Jul 23, 2021 · 2 comments

Comments

@openstreetmap-trac
Copy link

Reporter: LonelyPixel
[Submitted to the original trac issue database at 7.14pm, Friday, 9th January 2009]

If you select an icon to be drawn in a style, you can select some
cryptic name from the internal representation of the more or less
organised embedded icons. The file structure can only be known if you
look hard into the source code. If you want to create or edit your own
style and use more icons, it's very hard to enter these virtual file
names. Supplying your own files is also hard, because you need to enter
absolute pathnames. But how do you know where somebody will copy the
images to your style? (Absolute path names can never be portable.)

Here's the solution: If the icon filename specification does not contain
a backslash or slash (both are required features of an absolute path
specification), the path of the style file is prepended. So you can just
enter the icon's filename without a path, copy it in the same directory
as your style (.mas) file (or in a subdirectory) and you're done.

The current situation is that if you don't enter an absolute path, the
icon is loaded from the current directory - whichever that is. (At least
that's what I suppose after reading the original source code. I haven't
bothered finding out where that path is.)

Also, when you save a style back into a file, all absolute icon
filenames that have the same path as the style file to write, the path
is cut off so that only the filename is written. This keeps filenames
portable when saving the style. But it'll only work if the image files
are in the very same directory as the style file to be written. More
logic could be used here to detect subdirectories. Maybe I'll still do that.

This also has the effect that the style is fully portable and can be
given to and edited by other Merkaartor users, including all icons.

@openstreetmap-trac
Copy link
Author

Author: LonelyPixel
[Added to the original trac issue at 7.25pm, Friday, 9th January 2009]

Beware, Trac only shows the first and the last of the three patched files in its HTML preview of the patch. Something must be broken in there.

@openstreetmap-trac
Copy link
Author

Author: koying
[Added to the original trac issue at 7.51pm, Sunday, 11th January 2009]

(In [13150]) ADD : Save relative icon filenames in map styles if not builtin (closes #1463)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant