Closed hhornburg closed 4 years ago
Hi,
you can use stylemenus, but w/o gui
open the style xml file (Elevate.xml) with a text editor.
in the beginning of that file (about line #20) you find a line like this:
<stylemenu id="elv-menu" defaultvalue="elv-hiking" defaultlang="en">
this default value is used. with the line above, hiking style is used.
you can edit this line.
mtb:
<stylemenu id="elv-menu" defaultvalue="elv-mtb" defaultlang="en">
cycling:
<stylemenu id="elv-menu" defaultvalue="elv-cycling" defaultlang="en">
city:
<stylemenu id="elv-menu" defaultvalue="elv-city" defaultlang="en">
the "element" style uses different names like "elmt-hiking"
BTW: you can change also the symbol and textsize, when you change the url in youre app like: http://127.0.0.1:8080/{Zoom}/{x}/{y}.png?textScale=1.5&userScale=1.2 this syntax is from MyTourbook, youre app may differ.
Thomas
Thank you!
I made the edits you suggested, but can't see any difference. I cleared the cache of QMS and restarted the tileserver multiple times. Changing the suboptions like contourlines doesn't affect the displayed result. Also, all paths are missing.
BTW: you can change also the symbol and textsize, when you change the url in youre app like: http://127.0.0.1:8080/{Zoom}/{x}/{y}.png?textScale=1.5&userScale=1.2 this syntax is from MyTourbook, youre app may differ.
This however produced the wanted results, thanks.
aaah, you're right since MyTourbook directly supports openandromaps, i use this server very rare. seems so all themes are shown at once.
You can use the Elevate V2 Themes. eg "Elevate 2 XL" from oam
Thanks again. Whilst the paths now appear, the symbols are absurdely large. Any ideas why?
since MyTourbook directly supports openandromaps, i use this server very rare.
I guess you're then not overly motivated supporting stylemenus then? :smile: Is this easy to tweak, so I (Currently only coding in C++ and Python) could create a PR introducing this?
you can try userScale=0.8
PRs are Wellcome.
i was really confused that stylemenues are not working. strange. i must think about it...
Whilst the paths now appear, the symbols are absurdely large. Any ideas why?
"elevate 2" had 3 different files for different screens. maybe the version without the "xl" is better.
you can try userScale=0.8
That didn't help. XL and L has these large icons, the "normal" one has really small icons, independent of the userScale.
Ah, wait. I downloaded the Mapsforge 0.4 versions, the Mapsforge 0.3 version of the "normal" size looks good. Not sure however how the userScale works as I don't see any difference in the size expect that some symbols disappeared.
i think elevate 2 themes using bitmaps as symbols and the newer themes using svg symbols.
could be that userscale is only working with vector symbols
I am trying to find a solution, however I have troubles testing my changes.
What task do I have to start with gradlew to generate the files in the jars_ready2use
folder?
i only use gradle for upgrading the libs. but a good idea to use also to build the project.
I use eclipse as IDE. there i have some "run configurations" to test and start the server.
to create the jars_ready2use i rigthclick on the project and select "export"
the libs must must copied to a subfolder:
To start inside eclipse:
looks good:
some samples:
different mapengine, but also mapsforge maps and themes: https://github.com/telemaxx/mytourbook/blob/e41fef5e30673246d0551bd234cc206725631ceb/bundles/net.tourbook/src/net/tourbook/map25/Map25App.java#L405****
based on playground apps from vtm: https://github.com/mapsforge/vtm/blob/bdd08e348689620a498bc045e788eb78a07bd405/vtm-playground/src/org/oscim/test/MapsforgeStyleTest.java#L35
reopened, two keep it in mind...
I think a basic solution would be to respect the default settings set in the theme file. At the moment several users have to heavily edit the theme files to make them work with the server, like here: https://www.openandromaps.org/oam-forums/topic/qmapshack-2 It would be much easier for them to just have to edit some values in the stylemenu.
So only those layers which are enabled would be parsed. That would just be:
<stylemenu ...>
, which defines which mapstyle is used; mapstyles are all <layer ...>
with "visible=true"<overlays id="*">
and <cat id="*">
defined in the mapstyle definition are parsed; overlays are all <layer ...>
with "enabled=true/false"More about stylemenus here: https://github.com/mapsforge/mapsforge/blob/master/docs/Rendertheme.md#stylemenus
I was playing with file src\main\java\com\telemaxx\mapsforgesrv\MapsforgeHandler.java
and tested following modification which seems exactly to do what eartrumpet was proposing:
...
XmlRenderThemeMenuCallback callBack = new XmlRenderThemeMenuCallback() {
@Override
public Set<String> getCategories(XmlRenderThemeStyleMenu styleMenu) {
renderThemeStyleMenu = styleMenu;
String id = styleMenu.getDefaultValue();
XmlRenderThemeStyleLayer baseLayer = styleMenu.getLayer(id);
Set<String> result = baseLayer.getCategories();
for (XmlRenderThemeStyleLayer overlay : baseLayer.getOverlays()) {
if (overlay.isEnabled()) {
result.addAll(overlay.getCategories());
}
}
return result;
}
};
if (themeFile == null) {
xmlRenderTheme = InternalRenderTheme.OSMARENDER;
} else {
xmlRenderTheme = new ExternalRenderTheme(themeFile,callBack);
}
...
@eartrumpet thank you for the suggestions.
@JFritzle should I merge you're code or do you prefer sending me a PR? when you're send me a PR, you are listed as a contributor.
I will try to implement this weekend. and I have a additionally idea: a new parameter to set the stylemenue. when empty using default.
@telemaxx Thank you for working on tile server!
As this was my first Java activity, I prefer you to merge the code.
Concerning your additional idea: this is exactly what I have been thinking about too. Furthermore, I intended to extend the optional command line parameters as follows:
-s style(s)
… a comma-separated list of style layer ids to consider
-o overlay(s)
... a comma-separated list of overlay layer ids to consider in addition to base layer categories of style(s)
The ability to specify style and/or overlays by command line makes modifications of theme files unnecessary.
Examples:
-s hiking
... in addition to categories of base layer of style with id="hiking", categories of all overlay layers referenced by style with attribute enabled="true" get rendered
-s hiking -o hikingroutes,waymarks
... in addition to categories of base layer of style with id="hiking", categories of overlay layers with id="hikingroutes" and id="waymarks" get rendered, even if attribute enabled=”false”
-s hiking -o *
... in addition to categories of base layer of style with id="hiking", categories of all overlay layers referenced by style get rendered, even if attribute enabled=”false”
-s hiking,cycling
... in addition to categories of base layers of styles with id="hiking" and id="cycling", categories of all overlay layers referenced by both styles with attribute enabled="true" get rendered
-s * -o *
... results in current behavior, i.e. rendering categories of all styles and all overlays found in theme file, disregarding “defaultvalue” and values of visible and enabled attributes
Unfortunately, I failed to implement my intention due to missing Java experience.
commited new branch for testing: new style branch
currently only -s (one)style i like youre idea about using multi styles, eg mtb with cycling make much sense.
my xml skills are not good, but when someone send me a PR, i am happy to merge it.
i have also updated the jars_ready2use\Cycle.cmd
commands to demonstrate the new -s
option.
this type of names must be used: -s "elmt-hiking
"
when you start the server all containing styles are listed.
if you find the time to test, i can merge the new branch to master.
for me it looks good so far. for testing i used josm.
console output:
merged to master. closing issue.
tested:
Hi, I would love to use this tile server together with QMapShack and openandromaps. However the "Elevate" Themes from openandromaps use Stylemenus, which is not supported (as far as I can see) by this tile server. Is there a possibility to add support for Stylemenus? Thanks in advance!