Changes between Version 13 and Version 48 of Help/Preferences/RemoteControl


Ignore:
Timestamp:
(multiple changes)
Author:
(multiple changes)
Comment:
(multiple changes)

Legend:

Unmodified
Added
Removed
Modified
  • Help/Preferences/RemoteControl

    v13 v48  
    1 [[TranslatedPages(outdated=This page is missing some new options and the list of commands is probably better situated on a separate page.)]]
     1[[TranslatedPages(outdated=This page is incomplete. Options description is missing.)]]
    22= Preferences > Remote Control =
    33
    4 [[Image(source:trunk/images/preferences/remotecontrol.png)]] **Settings for the remote control feature.**
     4[[JOSMImage(preferences/remotecontrol,middle,,48,link=,margin-right=20)]] **Settings for the remote control feature**
    55
    6 Remote Control allows JOSM to be controlled from other applications, e.g. from a web browser, by opening a listening TCP port (8111) on localhost where it accepts commands.[[BR]]
    7 **Note**: Due to security reasons this feature is disabled in the default settings and has to be enabled manually.
     6Remote Control allows JOSM to be controlled from other applications, e.g. from a web browser, by opening a listening TCP port (8111) on localhost where it accepts commands. \\
     7From JOSM version r6941 through r15469 it was also listening for HTTPS on port 8112. \\
     8**Note**: Due to security reasons the Remote Control is disabled in the default settings and has to be enabled manually.
    89
     10For JOSM version r6941 through r15469, if you access a website via HTTPS and use the Remote Control it will also use HTTPS to control your JOSM. If it does not work, note that your browser, security addons/plugins and firewalls may block this access (you may be able to whitelist/allow it inside these tools) – check your logs. In addition you may need to tell your browser to accept the self-signed JOSM HTTPS certificate. More details on some of these issues: [https://help.openstreetmap.org/questions/2208/how-do-i-enable-the-remote-control-in-josm How do I enable the "remote control" in JOSM?] (on the OSM help site).
    911
    10 The following control options are available:
     12After JOSM r15469, websites cannot use HTTPS to control JOSM. Safari is the only major browser known to have issues with remote control commands on HTTPS websites.
    1113
    12 [[Image(remote_control_preferences.png)]]
     14**See the list of [wikitr:/Help/RemoteControlCommands Remote control commands].**
    1315
    14 
    15 * **Enable remote control** allows to switch the remote control feature on or off.
    16  * **Load data from API**
    17  * **Import data from URL**
    18  * **Load imagery layers**
    19  * **Change the selection**
    20  * **Change the viewport**
    21  * **Create new objects**
    22  * **Read protocol version**
    23 
    24 * **Confirm all Remote Control actions manually**
    25 
    26 == List of Commands ==
    27 === {{{load_and_zoom}}} ===
    28 Instructs JOSM to download a bounding box from the API, zoom to the downloaded area and optionally select one or more objects.
    29 {{{
    30 GET /load_and_zoom?left=...&right=...&top=...&bottom=...&select=object[,object...]
    31 }}}
    32 where
    33 ||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
    34 || `left` || R || minimum longitude ||
    35 || `right` || R || maximum longitude ||
    36 || `bottom` || R || minimum latitude ||
    37 || `top` || R || maximum latitude ||
    38 || `select` || O || comma-separated list of objects that should be selected. Object specifiers are combinations of the words "way", "node", or "relation", and the numerical object id. Example: {{{select=way38473,node12399,node54646}}} ||
    39 || `addtags` || O || Optional parameter to add tags. The key and value is separated by "=" and multiple tags can be separated by a Pipe "|". Try this one for [http://localhost:8111/load_and_zoom?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5&select=way23071688,way23076176,way23076177,&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325 example]. Works also with the zoom-command. The user must review the tags and the selection before the tags are applied to the selected objects. ||
    40 || `new_layer` || O || If true, downloads to a new layer ||
    41 
    42 ==== Example ====
    43 
    44 Start JOSM (don't forget to enable the !RemoteControl feature), then click on:
    45 
    46 [http://127.0.0.1:8111/load_and_zoom?left=8.19&right=8.20&top=48.605&bottom=48.590&select=node413602999]
    47 
    48 JOSM should now load an area in the German Schwarzwald and have the specified node selected.
    49 
    50 === {{{zoom}}} ===
    51 Instructs JOSM to zoom to the specified area and optionally select one or more objects.
    52 {{{
    53 GET /zoom?left=...&right=...&top=...&bottom=...&select=object[,object...]
    54 }}}
    55 Accepts the same parameters as the {{{load_and_zoom}}} command and uses the same code for zoom and selection. The only difference is that no data will be loaded from the API.
    56 
    57 **Hint**: This command can also be used to select objects only. Just enter a small arbitrary area to the left..bottom entries and add the object list to the select= option.
    58 === {{{import}}} ===
    59 Instructs JOSM to download the specified OSM file and add it to the current data set.
    60 {{{
    61 GET /import?url=...
    62 }}}
    63 
    64 
    65 
    66 === {{{imagery}}} ===
    67 Instructs JOSM to add an imagery (WMS/TMS) layer.
    68 {{{
    69 GET /imagery?title=...&type=...&url=...
    70 }}}
    71 where
    72 ||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
    73 || `title` || O || The display name of the layer ||
    74 || `type` || O || Type of the layer. Possible values are `wms` and `tms` [[BR]] (since !RemoteControl Version 1.3) ||
    75 || `min_zoom` || O || The minimum zoom level [[BR]] (since !RemoteControl Version 1.4) ||
    76 || `max_zoom` || O || The maximum zoom level. For higher scales, the images of the maximum level is enlarged [[BR]] (since !RemoteControl Version 1.4) ||
    77 || `url` || R || The Request URL, including patterns. Must be the last parameter, everything after "&url=" is interpreted as URL, even if it contains "&" characters.  ||
    78 
    79 ==== Examples ====
    80 * TMS layer "osm" {{{http://tile.openstreetmap.org/{zoom}/{x}/{y}.png}}}
    81 
    82 [http://localhost:8111/imagery?title=osm&type=tms&url=http://tile.openstreetmap.org/%7Bzoom%7D/%7Bx%7D/%7By%7D.png]
    83 
    84 * WMS layer "landsat" {{{http://irs.gis-lab.info/?layers=landsat&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox} }}}
    85 [http://localhost:8111/imagery?title=landsat&type=wms&url=http://irs.gis-lab.info/?layers=landsat&SRS=%7Bproj%7D&WIDTH=%7Bwidth%7D&HEIGHT=%7Bheight%7D&BBOX=%7Bbbox%7D]
    86 
    87 === {{{load_object}}} ===
    88 
    89 Instructs JOSM to download objects with a given id.
    90 {{{
    91 GET /load_object?new_layer=true|false&objects=...
    92 }}}
    93 where
    94 ||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
    95 || `objects` || R || Comma separated list of object ids, e.g. "{{{n1234,n1235,w84,r958493}}}" ||
    96 || `new_layer` || O || If true, downloads to a new layer ||
    97 
    98 ==== Example ====
    99 
    100 [http://localhost:8111/load_object?new_layer=true&objects=w106159509]
    101 
    102 === {{{add_node}}} ===
    103 
    104 Instructs JOSM to create a new node at the given coordinates.
    105 
    106 **Note**: This action requires the permission ''Create new objects'' which is disabled by default.
    107 
    108 {{{
    109 GET /add_node?lon=...&lat=...
    110 }}}
    111 where
    112 ||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
    113 || `lon` || R || The longitude of the node ||
    114 || `lat` || R || The latitude of the node ||
    115 
    116 ==== Example ====
    117 http://localhost:8111/add_node?lon=13.3&lat=53.2
    118 
    119 === {{{add_way}}} ===
    120 
    121 Instructs JOSM to create a new way with new way nodes at given coordinates.
    122 
    123 **Note**: This action requires the permission ''Create new objects'' which is disabled by default.
    124 
    125 {{{
    126 GET /add_way?way=lat1,lon1;lat2,lon2;...
    127 }}}
    128 where
    129 ||= **Parameter** =||= **Required/Optional** =||= **Meaning** =||
    130 || `way` || R || Pairs of latitude, longitude coordinates separated by semicolon. ||
    131 
    132 ==== Example ====
    133 
    134 http://localhost:8111/add_way?way=53.2,13.3;53.3,13.3;53.3,13.2
    135 
    136 
    137 === {{{version}}} ===
    138 This command returns the current protocol version of the installed !RemoteControl interface. Developers can use it to query for a running instance of JOSM and also determine whether the requested functionality is available in the client.
    139 {{{
    140 GET /version[?jsonp=callback]
    141 }}}
    142 
    143 The command returns a json object containing an application identifier that is always "JOSM !RemoteControl", a major number and a minor number. Compatible protocol changes result in an increase of the minor number. Incompatible changes increase the major number. So a client application knowing of protocol version 1.0 can still talk to JOSM having 1.1. But it's not guaranteed to be working with 2.0. So the client should verify the major number.
    144 
    145 A typical output looks like this:
    146 {{{
    147 #!js
    148 {
    149    "protocolversion": {
    150       "major": 1,
    151       "minor": 0
    152    },
    153    "application": "JOSM RemoteControl"
    154 }
    155 }}}
    156 For older browsers not implementing [http://en.wikipedia.org/wiki/Cross-Origin_Resource_Sharing Cross-Origin Resource Sharing (CORS)] the command provides the possibility for jsonp callback. Load the URL in a script tag and supply the name of a callback that will receive the JSON data.
    157 
    158 Following is some sample code that checks for CORS capabilities and uses [http://en.wikipedia.org/wiki/JSONP JSONP] as a fallback solution.
    159 {{{
    160 #!js
    161 // in addition to the CC-BY-SA of the wiki feel free to use the following source for any purpose without restrictions (PD)
    162 // credits and additions appreciated: http://wiki.openstreetmap.org/wiki/User:Stephankn
    163 
    164 function checkJOSM(version){
    165    alert(version.application + " uses protocol version " + version.protocolversion.major + "." + version.protocolversion.minor);
    166    // do something useful, maybe showing edit button
    167 }
    168 
    169 var url = "http://127.0.0.1:8111/version";
    170 var useFallback = false;
    171 // currently FF3.5, Safari 4 and IE8 implement CORS
    172 if (XMLHttpRequest) {
    173    var request = new XMLHttpRequest();
    174    if ("withCredentials" in request) {
    175       request.open('GET', url, true);
    176       request.onreadystatechange = function(){
    177          if (request.readyState != 4) {
    178             return;
    179          }
    180          if (request.status == 200) {
    181             checkJOSM(eval('(' + request.responseText + ')'));
    182          }
    183       };
    184       request.send();
    185    }
    186    else if (XDomainRequest) {
    187       var xdr = new XDomainRequest();
    188       xdr.open("get", url);
    189       xdr.onload = function(){
    190          checkJOSM(eval('(' + xdr.responseText + ')'));
    191       };
    192       xdr.send();
    193    } else {
    194       useFallback = true;
    195    }
    196 }
    197 else {
    198    // no XMLHttpRequest available
    199    useFallback = true;
    200 }
    201 
    202 if (useFallback) {
    203    // Use legacy jsonp call
    204    var s = document.createElement('script');
    205    s.src = url + '?jsonp=checkJOSM';
    206    s.type = 'text/javascript';
    207    
    208    if (document.getElementsByTagName('head').length > 0) {
    209       document.getElementsByTagName('head')[0].appendChild(s);
    210    }
    211    
    212 }
    213 }}}
    214 
    215 === Other commands ===
    216 Remotecontrol allows other plugins to add additional commands. The other registers a RequestHandler class and specifies a command to be handled by this class. The command syntax has to be defined by the other plugin.
    217 
    218 Reverter plugin since version 27091 makes use of this feature.
    219 
    220 == See also ==
    221 [http://wiki.openstreetmap.org/wiki/JOSM/Plugins/RemoteControl Old JOSM Remote-Plugin page at OSM wiki]
     16[[Image(PreferencesRemoteControl.2.png​,link=,800)]]
    22217
    22318----
    224 Back to [wiki:Help/Action/Preferences Preferences][[Br]]
    225 Back to [wiki:/Help Main Help]
     19Back to [wikitr:/Help/Action/Preferences Preferences] \\
     20Back to [wikitr:/Help Main Help]