Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Add an API to modify the rendering style at runtime #31
From thilo.mu...@gmail.com on July 30, 2010 09:04:45
Currently much of the rendering style is hard-coded and cannot be changed at runtime. But one of the strongest advantages of ad-hoc rendering is possibility to fully customize the rendering style (font sizes, colors, z-ordering, replace default POI symbols, hide certain elements, ...).
We therefore need to implement a mechanism like for example MapCSS ( http://wiki.openstreetmap.org/wiki/MapCSS ) and add an API to our map rendering component to control the rendering.
Original issue: http://code.google.com/p/mapsforge/issues/detail?id=31
From thilo.mu...@gmail.com on August 07, 2011 11:32:22
I have worked out a nice solution for this issue which works similar to the Osmarender styles (see http://wiki.openstreetmap.org/wiki/Osmarender/Rules ). I will commit everything in a few days, stay tuned ... :-)
From thilo.mu...@gmail.com on August 28, 2011 10:23:16
I have committed my current working copy in revision r1383 . There are still some known bugs (like for example missing water areas) and the performance needs to be polished. But besides that it works already quite well. Rendering is now completely configurable via XML files, which are very similar to osmarender stylesheets (see: http://wiki.openstreetmap.org/wiki/Osmarender/Rules ).
All "early adopters" are invited to check out the new version and test it, so that we can locate and fix as many bugs as possible prior to the next release (which will most likely be called 0.3.0). A detailed wiki article describing the structure of the render theme XML files and the new MapView API will be published later.
From LudwigBr...@gmail.com on September 13, 2011 03:11:29
I have had a play with r1405 and I have a suggestion that I believe will improve the usability of the XML configuration.
From my use case most changes in rendering style are small, they involve highlighting certain features or turning others off. In most cases therefore the XML for rendering is 95% identical, but there are large numbers of these small XML changes. This makes maintaining the XML files somewhat difficult and unwieldy.
My suggestion would be to have named rules that can be selectively turned on or off via an API.
For example, one change in the XML could be to turn off the rendering of buildings (a kind of nice feature that shows off OSM and the renderer, but somewhat useless actually for navigation and costly in processing). So a rule with names would look like this:
The additional API would allow to switch the rule on and off, based on its name, overriding the default in the XML.
The implementation could either involve a further check whether a rule is enabled (costly at runtime) or otherwise an active rule set could be compiled from the set of all rules when a change in configuration takes place.
From thilo.mu...@gmail.com on September 17, 2011 03:07:32
I really like your idea as it would make it much easier to create "derived" render themes. However, it increases the complexity of parsing and optimizing render themes a lot, therefore i will not implement it right now but rather focus on stability and performance for the first release.
From wms...@googlemail.com on September 22, 2011 23:51:52
the mapsforge is a very nice project! Can you look to "OSM MAP Composer". This is a Franwork to configure the tools for generate Garmin IMG files. Do you know "MAP Composer"? http://composer.waldpfa.de/index.php/MC/Composer It would be nice if you could marryd "mapsforge" with "OSM Composer"