logo separator

[mkgmap-dev] To do: If-Then-Else

From Richard Fairhurst richard at systemed.net on Sat Feb 18 16:36:34 GMT 2017

Dave Swarthout wrote:
> I came across the mkgmap ToDo list the other day and one item struck me 
> as something I would really like to see in a coming release. The ability
> to
> evaluate If-Then-Else constructs

At the risk of suggesting a massive diversion from mkgmap's direction of
travel, could I suggest looking into embedded scripting languages - and in
particular, Lua - rather than creating a whole new complex language in
mkgmap?

Several of the core tools for processing OSM data now use Lua scripts to
handle rendering and routing decisions for tags:

- osm2pgsql (database import for rendering)
- OSRM (routing)
- tilemaker (vector tiles)

It enables you to build complex processing chains really simply. Lua is
lightweight, fast, and easy to learn. All of the above three are C++ tools,
but Lua can work fine with Java (and other languages). I find it absolutely
invaluable, especially when making complex routing decisions based on tag
combinations.

In the three programs above, the user writes a Lua function which is called
for every way, usually with a hash of the way's tags. This Lua function can
then call functions that have been registered by the 'host' tool, to output
ways to the resulting routing/rendering database and access other
functionality.

Lua transforms are optional in osm2pgsql, and I'm sure that would be the
right avenue for mkgmap too. (It's notable that the default style on osm.org
is planning to start using Lua at the next database reload, to simplify SQL
queries inter alia.)

Just a thought - feel free to ignore, but Lua scripting has made such a
difference to my workflow that I couldn't not mention it.

cheers
Richard
(don't think I've posted to this list since building the first Garmin cycle
maps 2008/9ish!)




--
View this message in context: http://gis.19327.n8.nabble.com/To-do-If-Then-Else-tp5890726p5891577.html
Sent from the Mkgmap Development mailing list archive at Nabble.com.


More information about the mkgmap-dev mailing list