Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osmosis version 0.45 #11

Open
colinrlly opened this issue Aug 25, 2017 · 19 comments
Open

Osmosis version 0.45 #11

colinrlly opened this issue Aug 25, 2017 · 19 comments

Comments

@colinrlly
Copy link

I am trying to use this plugin with Osmosis version 0.45. This version has plexus-classworlds-2.5.2.jar in lib/default. In the instructions it says I may need to adjust bin/osmosis.bat. After installing and running Osmosis using --write-srtm the created .xml file includes on all the nodes. Can you speak more to what needs to be adjusted in the .bat file?

@locked-fg
Copy link
Owner

It's quite some time ago.
But back then the only adjustment was to ensure the correct version numbers.

But if you say that the output worked... This does not sound as if you'd need to change anything?

@colinrlly
Copy link
Author

colinrlly commented Aug 26, 2017

Thanks for the quick response. What I mean is every node in my osm file looks like this:

<node id="29568783" version="5" timestamp="2014-11-09T16:14:57Z" uid="2311536" user="JordanKepler" changeset="26666712" lat="34.8478941" lon="-82.358738"> <tag k="height" v="NaN"/> </node> <node id="29568784" version="5" timestamp="2014-11-09T16:14:57Z" uid="2311536" user="JordanKepler" changeset="26666712" lat="34.84785" lon="-82.3580849"> <tag k="height" v="NaN"/> </node>

None of them include an actual height value. When I say the output worked I mean the program didn't explode, but it didn't give the desired output either.

@colinrlly
Copy link
Author

Sorry I'm new to making issues on Github, I see my code example was never included in my original post.

@locked-fg
Copy link
Owner

Hm that's strange.
Just to be sure, did you try both directories and create / modify the .conf -file?:

  • Create bin\plugins and put the build/downloaded jar there (if this doesn't work, try lib\default)
  • create a osmosis-plugins.conf in the config-folder containing the following line de.locked.osmosis.srtmplugin.SrtmPlugin_loader

Maybe osmosis has changed the way the load plugins. If the above doesn't work, can you maybe get an older osmosis-version and try?

@locked-fg
Copy link
Owner

How's it going? did you manage to solve the issue?

@colinrlly
Copy link
Author

I tried putting the jar in bin/plugins and lib/default. I have osmosis-plugins.conf in osmosis-latest/config with that line in in. In both scenarios I get the same output:

stderr: Sep 01, 2017 7:29:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.45

stderr: Sep 01, 2017 7:29:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.

stderr: Sep 01, 2017 7:29:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.

stderr: Sep 01, 2017 7:29:22 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.

stderr: Sep 01, 2017 7:29:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline complete.

stderr: Sep 01, 2017 7:29:23 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Total execution time: 1450 milliseconds.

osmosis exited with code 0

My code looks like this. I'm using Node.js and spawning a child process that runs osmosis.bat.

var osmread = require('osm-read');
var cp = require('child_process')
var osmosis = require.resolve('./osmosis-latest/bin/osmosis.bat');
var bat = cp.spawn(
    osmosis, 
    ['--read-xml', '../../../static/burlington.xml', '--write-srtm', '--write-xml', '../../../static/burlington_with_srtp.xml'],
    {cwd: './osmosis-latest/bin'}
);

bat.stdout.on('data', function (data) {
    console.log('stdout: ' + data);
});

bat.stderr.on('data', function (data) {
    console.log('stderr: ' + data);
});

bat.on('exit', function (code) {
    console.log('osmosis exited with code ' + code);
});

Like I said before it has to be working somewhat because the program does modify my osm data to include <tag k="height" v="NaN"/> in every node.

@locked-fg
Copy link
Owner

Ah this was a good hint! Can you please first try if it just works in the console without NodeJS?
Just to test if its an issue with osmosis or with the environment provided by NodeJS.

@colinrlly
Copy link
Author

I tried it in the console and it has the same output. Pretty sure it's an issue with osmosis. The way I'm running it in Node should be equivalent to running it in a console. Like I said before though, it runs and works it just gives NaN for every node in the file. Are there places in your code where you assign NaN as the elevation?

@locked-fg
Copy link
Owner

At least I don't recall about it. Sorry that I currently cannot actively dig into the problem deeper.
SRTM files were downloaded / are locally available?

@colinrlly
Copy link
Author

I need to have the SRTM files on my computer? I have the osm .xml files but I didn't know I need to have the SRTM .hgt files. How do I tell the Osmosis plugin to use the SRTM files on my computer?

@locked-fg
Copy link
Owner

Nono, they are (they should!) be downloaded automatically. I just wonder if there is a download issue (server url changed, anti virus blocking download, corrupt files) that caused the NANs.
Judging the code in https://github.com/locked-fg/osmosis-srtm-plugin/blob/master/src/main/java/de/locked/osmosis/srtmplugin/SrtmPlugin_task.java
file issues cause return Double.NaN quite often.

Do you see a log file created during the process? Errors should be logged there.

@thyrfa
Copy link
Contributor

thyrfa commented Nov 9, 2017

I'm encountering the same issue, all nodes are returning NaN regardless of if I use local files or not. Sidenote, in Osmosis 0.46 the run fails with the message

SEVERE: Thread for task 1-read-xml failed
java.lang.AbstractMethodError: de.locked.osmosis.srtmplugin.SrtmPlugin_task.close()V
at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:107)
at java.base/java.lang.Thread.run(Thread.java:844)

but the output file does get generated anyways (with NaNs). If I run it in Osmosis 0.43.1 it doesn't give an error message but still fills every node with NaN.

Maybe related: If I use the prebuilt jar you provided, it has the above behavior, if I build the jar myself then it doesn't even provide NaN height tags.

@locked-fg
Copy link
Owner

Strange. If you're already in building the JAR yourself: can you maybe add some logging to see where the NANs are returned? I'd need to set up everything as I haven't touch this things for quite some time to be honest

@thyrfa
Copy link
Contributor

thyrfa commented Nov 13, 2017

Ok: I got it to work. Takeaways:

  1. The server downloading functionality does not work anymore. It will return error. Not a huge priority if you just direct users to the website to manually download files AND
  2. Make sure the users have .hgt.zip, I didnt realize this and unzipped them (Whoops).
  3. The prebuilt version you link to is behind the current live github version. The live version does not write to the height tag if the value is NaN while the prebuilt version does. (Explains my confusion).
  4. Regardless of using Java 8 or Java 9 (Figured I would check both) Osmosis 0.46 will return the below error when using the plugin. I recommend 0.43.1 for compatibilities sake, but even though Osmosis 0.46 returns the below error, the data still gets written correctly

SEVERE: Thread for task 1-read-xml failed
java.lang.AbstractMethodError: de.locked.osmosis.srtmplugin.SrtmPlugin_task.close()V
at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:107)
at java.lang.Thread.run(Thread.java:748)

Nov 13, 2017 6:39:50 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
at
org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
Truncated for space

In Summary: It works as long as users go manually get the files and put them in a folder, making sure all the .hgt files stay zipped.

@thyrfa
Copy link
Contributor

thyrfa commented Nov 13, 2017

Made a PR for the README so others will know the workaround.

@locked-fg
Copy link
Owner

Thanks a lot! At least there is a workaround!

@redonggaojianbing
Copy link

So, Thyrfa. How did you reslove the problem that all the node provide NaN height tags?

@thyrfa
Copy link
Contributor

thyrfa commented Apr 4, 2019

Like it clearly says above:

It works as long as users go manually get the files and put them in a folder, making sure all the .hgt files stay zipped.

Go through the steps in the readme and you should be fine.

@redonggaojianbing
Copy link

It goes well. Thank you so much!

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

No branches or pull requests

4 participants