| Version 3 (modified by , 14 years ago) ( diff ) |
|---|
Інші мови:
- Ελληνικά
- English
- Esperanto
- español
- français
- norsk bokmål
- Nederlands
- русский
- українська
- @9 - @48
Налаштування > Дистанційне керування
Налаштування функцій дистанційного керування.
Дистанційне керування дозволяє JOSM’му бути керованим з інших застосунків, наприклад з оглядачів, відкриваючи на прослуховування порт TCP (8111) на локальному комп’ютері для отримання команд.
Примітка З причин підтримання безпеки ця функція відключена у типових налаштуваннях, її треба ввімкнути вручну.
Доступні наступні функції керування:
- Включити дистанційне керування дозволяє вмикати або вимикати цю функцію.
- Завантаження даних через API
- Імпорт даних за посиланням
- Завантаження шарів із фоном
- Зміна виділення
- Зміна положення поточного вікна мапи
- Створення нових об’єктів
- Отримання версії протоколу
- Підтверджувати всі дії Дистанційного керування вручну
Перелік команд
load_and_zoom
Команда для завантаження в JOSM даних габаритного прямокутника через API, та масштабування завантаженої ділянки та, необов’язково, виділення одного чи кількох об’єктів.
GET /load_and_zoom?left=…&right=…&top=…&bottom=…&select=object[,object…]
де
| Параметр | Обов’язковий/необов’язковий | Опис |
|---|---|---|
left | R | мінімальна довгота |
right | R | максимальна довгота |
bottom | R | мінімальна широта |
top | R | максимальна широта |
select | O | розділений комами перелік об’єктів, які потрібно виділити. Об’єкти вказуються комбінацією слів "way", "node" або "relation" та числовим id. Example: select=way38473,node12399,node54646
|
addtags | O | необов’язковий параметр для додавання теґів. Ключі та значення відокремлюються знаком "=", а кілька теґів можуть бути розділені "|". Спробуйте цей приклад. Працює також із командою zoom. Користувачу потрібно спочатку переглянути теґи та виділення перед тим, як теґи будуть застосовані до виділених об’єктів. |
new_layer | O | Якщо «істина», завантажити до нового шару |
Приклад
Запустіть JOSM (не забудьте увімкнути Дистанційне керування), потім клацніть на:
JOSM повинен завантажити ділянку у німецькому Шварцвальді та виділити вказану точку.
zoom
Instructs JOSM to zoom to the specified area and optionally select one or more objects.
GET /zoom?left=...&right=...&top=...&bottom=...&select=object[,object...]
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.
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.
import
Instructs JOSM to download the specified OSM file and add it to the current data set.
GET /import?url=...
imagery
Instructs JOSM to add an imagery (WMS/TMS) layer.
GET /imagery?title=...&type=...&url=...
where
| Parameter | Required/Optional | Meaning |
|---|---|---|
title | O | The display name of the layer |
type | O | Type of the layer. Possible values are wms and tms (since RemoteControl Version 1.3) |
url | R | The Request URL, including patterns. Must be the last parameter, everything after "&url=" is interpreted as URL, even if it contains "&" characters. |
Examples
- TMS layer "osm"
http://tile.openstreetmap.org/{zoom}/{x}/{y}.png
- WMS layer "landsat"
http://irs.gis-lab.info/?layers=landsat&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}
load_object
Instructs JOSM to download objects with a given id.
GET /load_object?new_layer=true|false&objects=...
where
| Parameter | Required/Optional | Meaning |
|---|---|---|
objects | R | Comma separated list of object ids, e.g. "n1234,n1235,w84,r958493"
|
new_layer | O | If true, downloads to a new layer |
Example
http://localhost:8111/load_object?new_layer=true&objects=w106159509
add_node
Instructs JOSM to create a new node at the given coordinates.
Note: This action requires the permission Create new objects which is disabled by default.
GET /add_node?lon=...&lat=...
where
| Parameter | Required/Optional | Meaning |
|---|---|---|
lon | R | The longitude of the node |
lat | R | The latitude of the node |
Example
http://localhost:8111/add_node?lon=13.3&lat=53.2
add_way
Instructs JOSM to create a new way with new way nodes at given coordinates.
Note: This action requires the permission Create new objects which is disabled by default.
GET /add_way?way=lat1,lon1;lat2,lon2;...
where
| Parameter | Required/Optional | Meaning |
|---|---|---|
way | R | Pairs of latitude, longitude coordinates separated by semicolon. |
Example
http://localhost:8111/add_way?way=53.2,13.3;53.3,13.3;53.3,13.2
version
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.
GET /version[?jsonp=callback]
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.
A typical output looks like this:
{ "protocolversion": { "major": 1, "minor": 0 }, "application": "JOSM RemoteControl" }
For older browsers not implementing 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.
Following is some sample code that checks for CORS capabilities and uses JSONP as a fallback solution.
// in addition to the CC-BY-SA of the wiki feel free to use the following source for any purpose without restrictions (PD) // credits and additions appreciated: http://wiki.openstreetmap.org/wiki/User:Stephankn function checkJOSM(version){ alert(version.application + " uses protocol version " + version.protocolversion.major + "." + version.protocolversion.minor); // do something useful, maybe showing edit button } var url = "http://127.0.0.1:8111/version"; var useFallback = false; // currently FF3.5, Safari 4 and IE8 implement CORS if (XMLHttpRequest) { var request = new XMLHttpRequest(); if ("withCredentials" in request) { request.open('GET', url, true); request.onreadystatechange = function(){ if (request.readyState != 4) { return; } if (request.status == 200) { checkJOSM(eval('(' + request.responseText + ')')); } }; request.send(); } else if (XDomainRequest) { var xdr = new XDomainRequest(); xdr.open("get", url); xdr.onload = function(){ checkJOSM(eval('(' + xdr.responseText + ')')); }; xdr.send(); } else { useFallback = true; } } else { // no XMLHttpRequest available useFallback = true; } if (useFallback) { // Use legacy jsonp call var s = document.createElement('script'); s.src = url + '?jsonp=checkJOSM'; s.type = 'text/javascript'; if (document.getElementsByTagName('head').length > 0) { document.getElementsByTagName('head')[0].appendChild(s); } }
Other commands
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.
Reverter plugin since version 27091 makes use of this feature.
Дивись також
Стара сторінка втулка Дистанційного керування JOSM Remote-Plugin в OSM-Вікі
Назад до меню Налаштування
Назад до основної сторінки Довідки


