Modify

Opened 2 months ago

Closed 2 months ago

Last modified 6 weeks ago

#15273 closed enhancement (fixed)

extend command line interface: commands

Reported by: bastiK Owned by: team
Priority: normal Milestone: 17.09
Component: Core Version:
Keywords: Cc:

Description (last modified by bastiK)

It would be useful to have access to certain JOSM features via command line, e.g. validation (#15182), projection, rendering (#15229). For this purpose, I suggest the following extended syntax:

java -jar josm.jar <keyword> <options> <args>

So for instance to use projection or rendering features, it would be

java -jar josm.jar projection -v +init=epsg:4326 +to +init=epsg:3857 <input.txt
java -jar josm.jar rendering -i data.osm --style style.mapcss --zoom 16 --box ... -o img.jpg

The current command line features are accessed with the josm keyword, which is the default and optional. Both of the following starts JOSM and opens the file track1.gpx:

java -jar josm.jar josm track1.gpx
java -jar josm.jar track1.gpx

If we have separate jar files for modules in the future, then you would simply drop the keyword:

java -jar josm-projection.jar -v +init=epsg:4326 +to +init=epsg:3857 <input.txt
java -jar josm-rendering.jar -i data.osm --style style.mapcss --zoom 16 --box ... -o img.jpg

Update:

Documentation of commands for the main help text:

Java OpenStreetMap Editor [JOSM/1.5 (12915 SVN en) Linux Ubuntu 17.04]

usage:
	java -jar josm.jar [<command>] <options>...

commands:
	runjosm     launch JOSM (default, performed when no command is specified)
	render      render data and save the result to an image file
	project     convert coordinates from one coordinate reference system to another

For details on the render and project commands, run them with the --help option.
The remainder of this help page documents the runjosm command.

options:
	--help|-h                                 Show this help
...

Attachments (0)

Change History (19)

comment:1 Changed 2 months ago by stoecker

Hmm. That's very complex to understand and we don't have so many options. I made tools with 50 or more options and they have a shortage of shortcut letters, but josm is far away from that limit.

I'd suggest to simply ensure that different parts don't have conflicting options.

comment:2 in reply to:  1 Changed 2 months ago by bastiK

Replying to stoecker:

Hmm. That's very complex to understand and we don't have so many options.

It mimics apt-get update|upgrade|install, svn status|commit, etc. In a similar way, the different JOSM subcommands have very little in common.

I'd suggest to simply ensure that different parts don't have conflicting options.

Still you need to tell it what to do. Instead of josm rendering ... it would be josm --action=rendering or josm --rendering, which is hardly any simpler.

comment:3 Changed 2 months ago by Don-vip

I like the idea but not the wording. The commands should not describe the underlying module (validation, rendering) but the action offered: validate, render. You don't say "apt-get updating" ;)

comment:4 Changed 2 months ago by bastiK

Resolution: fixed
Status: newclosed

In 12792/josm:

closes #15273, see #15229, see #15182 - add command line interface module for projections

  • run josm project --help to see the options
  • extracts parser from LatLon and CustomProjection into LatLonParser

comment:5 Changed 2 months ago by bastiK

Milestone: 17.09

The normal command line help text needs to be updated to let the users know about the feature, but I'll let it settle a bit.

comment:6 Changed 2 months ago by bastiK

In 12793/josm:

see #15273, see #15229, see #15182 - add missing class

comment:7 Changed 2 months ago by bastiK

In 12795/josm:

see #15273, see #15229 - fix unit tests, PMD, etc.

comment:8 Changed 7 weeks ago by bastiK

In 12906/josm:

see #15273, see #15229 - add command line module for rendering

run josm render --help to see the options

comment:9 Changed 7 weeks ago by bastiK

In 12907/josm:

see #15273, see #15229 - fix tests and Jenkins warnings

comment:10 Changed 7 weeks ago by bastiK

In 12911/josm:

see #15273 - document new features in the main help page

comment:11 Changed 7 weeks ago by bastiK

Description: modified (diff)
Summary: extend command line interface: keywordsextend command line interface: commands

comment:12 Changed 6 weeks ago by bastiK

In 12963/josm:

see #15273 - extract rendering code to new class

comment:13 Changed 6 weeks ago by bastiK

In 12964/josm:

see #15273 - more straightforward way to set up the styles for rendering

comment:14 Changed 6 weeks ago by bastiK

In 12966/josm:

use RenderingHelper in MapCSSRendererTest; move getBackgroundColor() from PaintColors to ElemStyles (no longer global) (see #15273)

comment:15 Changed 6 weeks ago by Don-vip

There's a bug in latest commits, Jenkins job fails and JOSM crashes at startup:

java.lang.ExceptionInInitializerError
	at org.openstreetmap.josm.gui.mappaint.MapPaintMenu.<init>(MapPaintMenu.java:90)
	at org.openstreetmap.josm.gui.MainMenu.initialize(MainMenu.java:704)
	at org.openstreetmap.josm.gui.MainFrame.initialize(MainFrame.java:102)
	at org.openstreetmap.josm.gui.MainApplication.initializeMainWindow(MainApplication.java:473)
	at org.openstreetmap.josm.Main$InitializationTask.call(Main.java:603)
	at org.openstreetmap.josm.Main.runInitializationTasks(Main.java:529)
	at org.openstreetmap.josm.Main.initialize(Main.java:505)
	at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:1024)
	at org.openstreetmap.josm.gui.MainApplication$2.processArguments(MainApplication.java:277)
	at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:861)
Caused by: java.lang.NullPointerException
	at org.openstreetmap.josm.gui.mappaint.MapPaintStyles.addMapPaintSylesUpdateListener(MapPaintStyles.java:464)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.<init>(ElemStyles.java:81)
	at org.openstreetmap.josm.gui.mappaint.MapPaintStyles.<clinit>(MapPaintStyles.java:48)
	... 10 more
Last edited 6 weeks ago by Don-vip (previous) (diff)

comment:16 Changed 6 weeks ago by Don-vip

In 12967/josm:

see #15273 - fix initialization of MapPaintStyles (NPE)

comment:17 Changed 6 weeks ago by bastiK

In 12968/josm:

see #15273 - fix backgroundColorCache invalidation

comment:18 Changed 6 weeks ago by bastiK

In 12971/josm:

see #15273 - fix: cache field should not be static

comment:19 Changed 6 weeks ago by bastiK

In 12972/josm:

see #15273 - update reference images for test

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.