treee111 / wahooMapsCreator

Create maps for Wahoo device based on latest OSM maps
247 stars 25 forks source link

Mapwriter plugin missing in the current osmosis package #229

Closed qB0t closed 9 months ago

qB0t commented 9 months ago

Followed all the instructions for Mac OS, tried creating a map for Cyrpus (only one country) and got this:

ERROR:subprocess error output:
ERROR:Nov 15, 2023 10:30:10 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.49.0
Nov 15, 2023 10:30:10 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Nov 15, 2023 10:30:10 AM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Task type mw doesn't exist.
    at org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactoryRegister.getInstance(TaskManagerFactoryRegister.java:69)
    at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.buildTasks(Pipeline.java:51)
    at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.prepare(Pipeline.java:112)
    at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:86)
    at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)

ERROR:Error in creating map file via Osmosis with tile: 150,100. mapwriter plugin installed?

Was unable to install any other version of osmosis than the current 0.49.0 that comes with brew.

treee111 commented 9 months ago

Hi @qB0t, the mapwriter plugin does not come with the osmosis installation. It is downloaded during usage of wahooMapsCreator and saved in path: /Users/<username>/.openstreetmap/osmosis/plugins

  1. Could you please have a look what files are in this path on your Mac. There should be a file with the name mapsforge-map-writer-0.18.0-jar-with-dependencies.jar. Maybe this is a authorization issue.
  2. Which version of wahooMapsCreator are you using? run inside your Anaconda environment: pip show wahoomc
  3. What are the first lines of output if you run processing of a example country using this command? python -m wahoomc cli -co malta -v
alfh commented 9 months ago

I have been thinking if one should replace the osmosis with rather using osmium merge for this as well. It seems we are using osmium for most of the steps. And although I really like Java, it would allow us to just use one tool, and also not requiring the Java to be installed and the separate plugin to be downloaded.

I have not actually tried the osmium merge, but it is on my todo list. I also saw that there is a "tag replace" functionality as part of osmium, although it requires a separate tool from the same author as osmium. At least it would be fun to try manually if the osmium merge produces the same results as omsosis.

@treee111, I also wonder if it has been considered before to replace osmosis ? It seems to be in "maintenance mode", with no new features being added. So the osmium seems like a better long term solution as well.

treee111 commented 9 months ago

I think a long time ago I concentrated on using fewer and the same tools on both (main) supported OS: macOS and Windows. You are right, at the moment there are still some tools used and different installation methods for both OS (and maybe also different tools when looking into very detail).

If I remember correct, writing map files using the mapwriter plugin was one thing not easy to replace.

If the results are the same (unittests) or at least very near on both OS, I have no problem switching tools. Apart from performance I have no features on the roadmap and in combination with limited time at the moment wahooMapsCreator is mainly in maintenance mode.

Thank you for your contributions to keep the lights on and have some codechanges 👍

217 goes into the same direction where I am working on at the moment.

ldimlight commented 9 months ago

I've had the same issue with mapsforge-map-writer plugin not being loaded by osmosis, although the plugin file exists. I've managed to solve this issue by downgrading osmosis to version 0.47, which works. I've uninstalled the brew version, downloaded the older one from http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-0.47.tgz, unpacked and added the bin folder to $PATH and the wahooMapsCreator runs successfully.

ldimlight commented 9 months ago

I see they've removed plugin support from osmosis 0.49.

From changelog https://github.com/openstreetmap/osmosis/releases for 0.49.0: Remove Java Plugin Framework support (standard Osmosis plugin support remains).

And mapsforge-map-writer was one of those plugins.

alfh commented 9 months ago

Not familiar with the two plugin concepts, but I see https://github.com/mapsforge/mapsforge/blob/master/mapsforge-map-writer/src/main/config/osmosis-plugins.conf and this commit https://github.com/openstreetmap/osmosis/commit/95a380b3724159965cc0535116057d30e42d65ff

Osmosis has two ways of registering plugins, the method used by all
in-built tasks (i.e. search for osmosis-plugins.conf files) and a JPF
(Java Plugin Framework) method.  The JPF mechanism was added before
Osmosis had any other concept of plugins but has became redundant when
Osmosis was refactored into many Java modules and developed its own
plugin mechanism.  The JPF approach may have some advantages around
classloader separation but it's very complicated and hard to understand.
This change simplifies the Osmosis startup process considerably.

So to me, it seems like the mapwrite plugin would still be supported

treee111 commented 9 months ago

Hi all, thanks for digging into this! You are right, the way of installing the Map Writer plugin like written in the docs is not valid anymore. I was able to reproduce on my device and opened a issue to get to know the way of correctly registering plugins in osmosis v0.49.0: https://github.com/openstreetmap/osmosis/issues/140. I'll try out on my device if I get it to work with help of the internet.

treee111 commented 9 months ago

a little update on this issue:

  1. as a hack (and how other integrated plugins work), this has been tested by some people and works:

    • put the map-writer plugin into libexec/plugins
    • add to the the classpath in libexec/osmosis at the end of the line: :$APP_HOME/plugins/*
  2. @alfh made good progress of reverting the removal of JPF. It seams that osmosis team will have the JPF feature back in a later release and means that the implementation Mapwriter plugin in wahooMapsCreator can stay as-is. Hence we will not dig into getting the hack or any other way implemented.

treee111 commented 9 months ago

Hi @qB0t, new version of osmosis is released & published to brew. See the referenced PR and FAQ for reference.

Would be happy if you could check on your end if the latest osmosis version works as well. Thanks! 👍