source: geovis/branches/1.0/geovis_protocol.txt @ 6666

Last change on this file since 6666 was 6564, checked in by ldelgass, 8 years ago

Update protocol doc

File size: 19.8 KB
Line 
1================================================================================
2================================================================================
3Protocol for geovis render server. 
4
5Commands take the general form of command and arguments using Tcl syntax and are
6terminated by a newline.  Some command arguments expect a Tcl list which can be
7sent by enclosing the list in curly braces to prevent the interpreter from
8splitting the list into multiple arguments.  Likewise, strings with spaces
9should be quoted or enclosed in curly braces.  In the documentation below,
10arguments are indicated by angle brackets and optional arguments are surrounded
11by question marks -- the brackets and question marks are not part of the
12protocol and should not be included in argument strings.  The arguments shown
13in angle brackets should be replaced with a string (where there are fixed
14choices this document indicates valid values by separating them with pipe
15symbols), a list in Tcl syntax, or a numeric value.  Boolean arguments can take
16the form of 0|1, true|false, or yes|no.  Since the protocol commands are
17executed in a Tcl interpreter, Tcl code such as math expressions in expr
18commands enclosed in square brackets are also allowed.  Since the interpreter
19is a "safe" interpreter, some Tcl commands that could cause security issues may
20not be available for use.
21
22When binary data is to be sent, it should follow the newline after a command
23that indicates incoming data including a byte count argument.
24================================================================================
25================================================================================
26Requests:
27================================================================================
28
29== General scene and renderer commands ==
30
31camera delete <name>
32       Delete named viewpoint
33camera dist <distance>
34       Set camera distance from focal point
35camera extent <xmin> <ymin> <xmax> <ymax> <?duration?> <?srs?>
36       Zoom to extent.  Will fit the extent to the vertical FOV and center on
37       the extent centroid.
38       <xmin>,<ymin>,<xmax>,<ymax> = extent bounds in the specified SRS,
39       or in the map's SRS if none is specified.
40       <duration> = Duration of viewpoint move animation in seconds
41       <srs> = The SRS of the extent bounds
42camera get
43       Request camera parameters
44camera go <x> <y> <?zoomFactor?> <?duration?>
45       Move camera to new focal point.
46       <x>,<y> = Screen/mouse coordinates
47       <zoomFactor> = Zoom distance multiplier, 1.0=no zoom
48       <duration> = Duration of viewpoint move animation in seconds
49camera lextent <layerName> <?duration?>
50       Zoom to layer extent.  Will fit the extent to the vertical FOV and center
51       on the extent centroid.
52       <layerName> = Name of layer to use for extent.
53       <duration> = Duration of viewpoint move animation in seconds
54camera orient <quatW> <quatX> <quatY> <quatZ>
55       Set scene orientation using a quaternion
56camera pan <x> <y>
57       <x,y> viewport coordinates (window center at 0,0).  Positive x pan
58       means pan object to right (camera to left).  Positive y pan means
59       pan object down (camera up).  For example a pan of 0.5, 0.5 would
60       move the object center to the lower right corner of the window
61camera reset <?all?>
62       Option all resets orientation/rotation as well as pan/zoom/clip range
63camera restore <name> <?duration?>
64       Set viewpoint to a named viewpoint, with optional animation duration in
65       seconds
66camera rotate <x> <y>
67       Specify relative rotation in viewport coordinates
68camera save <name>
69       Save current viewpoint to a named viewpoint
70camera set <x> <y> <z> <heading> <pitch> <distance> <?duration?> <?srs?> <?vertDatum?>
71       Explicitly set camera parameters, with optional animation duration in
72       seconds
73       <x>, <y> = Map coordinates of focal point
74       <z> = Altitude of focal point (see vertDatum)
75       <heading> = Azimuth in degrees
76       <pitch> = Elevation in degrees
77       <distance> = Distance of camera from focal point in map units(?)
78       <srs> = coordinate system, defaults to map coordinate system
79       <vertDatum> = vertical datum for interpreting z coordinate
80camera throw <bool>
81       Enable/disable throw inertia for panning/rotating when using mouse events
82       through protocol
83camera zoom <y>
84       Specify zoom by viewport coordinates (i.e. normalized y mouse coords)
85
86clientinfo <list>
87
88colormap add <colorMapName> <colorMap>
89         (Re-)define a colormap.  If colorMapName doesn't exist, it is created,
90         otherwise the colormap is redefined and all users will be updated.
91         colorMap = Tcl list of {value r g b a} control points
92colormap define <colorMapName> <colorMap>
93         (Re-)define a colormap (same as 'add')
94colormap delete <?colorMapName?>
95colormap res <numberOfTableEntries>
96         Set the "resolution" or number of lookup table entries in the colormap
97         <numberOfTableEntries> = integer or "default"
98
99legend <colormapName> <w> <h> <?opaque?> <?bgR?> <?bgG?> <?bgB?>
100       Render a legend colorbar.
101       <colormapName> - Name of the colormap defined with the colormap command
102       <w>,<h> - width and height of colorbar
103       <opaque> - If false, blend with background color
104       <bgR>,<bgG>,<bgB> - Background color (defaults to black)
105
106renderer render
107         Force a new image to be rendered
108
109screen bgcolor <r> <g> <b>
110screen coords <token> <coordList> <?srs?> <?verticalDatum?>
111       Transate map coordinates to screen/mouse coordinates.
112       <token> - String token, included in response
113       <coordList> - A list of x,y,z map coordinates.  If <srs> is not given,
114       these are in the map's coordinate system.
115       <srs> - Optional horizontal srs init string for coordinate system of
116       x,y,z
117       <verticalDatum> - Optional vertical srs init string for coordinate system
118       of x,y,z
119screen size <width> <height>
120
121== Mouse and Keyboard Events ==
122
123key press <key>
124key release <key>
125
126mouse click <button> <x> <y>
127mouse dblclick <button> <x> <y>
128mouse drag <button> <x> <y>
129mouse motion <x> <y>
130mouse release <button> <x> <y>
131mouse scroll <direction>
132
133== Interaction Configuration ==
134
135placard config <attrlist> <style> <padding> <layerName>
136    <attrlist> - List of attributes.  The list should consist of alternating
137    attribute names and attribute labels.  The names are the column names of the
138    attributes in the feature data and the corresponding labels will be
139    displayed on the info placard
140    <style> - CSS style attributes for TextSymbol and PolygonSymbol (fill for
141    backing quad)
142    <padding> - Pixels of padding between text and edge of backdrop quad.
143    <layerName> - The name of the layer containing the feature data.
144
145placard enable <bool> <layerName>
146    Enable/disable display of feature attribute placard on select.
147    <layerName> - The name of the layer containing the feature data.
148
149select clear
150    Clear any annotation or feature selection
151
152select fadd <featureIDList> <layerName>
153    Add features to the selected set
154    <featureIDList> - List of feature IDs to be selected.
155    <layerName> - The name of the layer containing the feature data.
156
157select fdelete <featureIDList> <layerName>
158    Remove features from the selected set
159    <featureIDList> - List of feature IDs to be selected.
160    <layerName> - The name of the layer containing the feature data.
161
162select feature <featureIDList> <layerName>
163    Set/replace the set of currently selected features
164    <featureIDList> - List of feature IDs to be selected.
165    <layerName> - The name of the layer containing the feature data.
166
167select mode <mode>
168    <mode> - boolean: Enable/disable click to select mode.
169
170== Map Commands ==
171
172map attrib <string>
173    <string> - Attribution/copyright to display in corner of map
174
175map coords <token> <coordList> <?srs?> <?verticalDatum?>
176    Translate screen/mouse coordinates into map coordinates.
177    <token> - String token, included in response
178    <coordList> - A list of x,y screen/mouse coordinates
179    <srs> - Optional horizontal srs init string for coordinate system to return
180    <verticalDatum> - Optional vertical srs init string for coordinate system to
181    return
182
183map grid <bool> <?type?>
184    Toggle graticule and set type
185    <type> = geodetic|utm|mgrs
186
187General form:
188map layer add <layerName> <type> <driver> <?url?> <?cache?> ...
189    <type> = image|elevation|feature|icon|line|mask|model|point|polygon|text
190    <driver> = arcgis|colorramp|db|debug|gdal|ogr|tfs|tms|wcs|wfs|wms|xyz
191    <cache> = bool indicating if tiles should be cached on disk
192
193Specific image layer types:
194map layer add <layerName> image agglite <url> <cache> <coverage> <featuredriver> <format> <typeName> <styleLen> <?scriptLen?> <?selectorsLen?>
195    Rasterize a feature source to an image layer using the AGGLite renderer
196    <url> = URL of source
197    <cache> = bool indicating if tiles should be cached on disk
198    <coverage> = bool indicating if data should not be interpolated (true means
199    no interpolation)
200    <featuredriver> = Feature driver to read source (db, ogr, tfs, wfs)
201    <format> = See Feature/model layers below
202    <typeName> = See Feature/model layers below
203    <styleLen> = See Feature/model layers below
204    <scriptLen> = See Feature/model layers below
205    <selectorsLen> = See Feature/model layers below
206map layer add <layerName> image colorramp <url> <cache> <coverage> <elevdriver> <profile> <colormapName>
207    Add a colormapped image layer from a file or URL
208    <url> = URL of source
209    <cache> = bool indicating if tiles should be cached on disk
210    <coverage> = bool indicating if data should not be interpolated (true means
211    no interpolation)
212    <elevdriver> = Elevation driver to read source
213    <profile> = profile of source
214    <colormapName> = Name of colormap
215map layer add <layerName> image arcgis <url> <?cache?> <?coverage?> <?token?> <?layers?>
216    Add an ArcGIS MapServer image layer from a URL
217    <url> = URL of source
218    <cache> = bool indicating if tiles should be cached on disk
219    <coverage> = bool indicating if data should not be interpolated (true means
220    no interpolation)
221    <token> = login credential
222map layer add <layerName> image gdal <url> <?cache?> <?coverage?>
223    Add a GDAL image layer from a file or URL
224    <url> = URL of source
225    <cache> = bool indicating if tiles should be cached on disk
226    <coverage> = bool indicating if data should not be interpolated (true means
227    no interpolation)
228map layer add <layerName> image wms <url> <cache> <coverage> <layers> <format> <transparent> <?times?> <?frameSeconds?>
229    Add a WMS image layer from a URL + layer string
230    <url> = URL of WMS service
231    <cache> = bool indicating if tiles may be cached on disk
232    <coverage> = bool indicating if data should not be interpolated (true means
233    no interpolation)
234    <layers> = layers string for WMS server
235    <format> = Image format to return (e.g. 'png')
236    <transparent> = bool
237    <times> = optional comma separated list of timestamps for WMS-T
238    <frameSeconds> = time in seconds to display each animated frame for WMS-T
239map layer add <layerName> image tms <url> <cache> <coverage>
240    Add a TMS image layer from a URL
241    <url> = URL of TMS service
242    <cache> = bool indicating if tiles should be cached on disk
243    <coverage> = bool indicating if data should not be interpolated (true means
244    no interpolation)
245map layer add <layerName> image xyz <urlPattern> <cache> <coverage>
246    Add an image layer from a web map using a template URL
247    <urlPattern> = URL template of source.  '{x}', '{y}', '{z}' will be replaced
248    with tile row (x), column (y) and zoom level (z).  A block of characters in
249    square braces can be used to specify round-robin server numbers, e.g.
250    'host[012]' will exand to 'host0', host1', 'host2'.
251    <cache> = bool indicating if tiles should be cached on disk
252    <coverage> = bool indicating if data should not be interpolated (true means
253    no interpolation)
254
255Elevation layers:
256map layer add <layerName> elevation <driver> <url> <?cache?> <?verticalDatum?>
257    Add an elevation image layer from a file or URL
258    <driver> = gdal|tms|wcs
259    <verticalDatum> = override vertical datum in file.  This is required for
260    the gdal driver if the vertical datum is a geoid (i.e. not geodetic HAE).
261
262Feature/model and mask layers:
263In the following:
264<driver> = db|ogr|tfs|wfs
265<url> = file/web service address, or for driver 'db' the postgis connection
266string
267<format> = json|gml (for tfs or wfs driver)
268<typeName> = layer name for db or wfs driver
269<clamping> = none|terrain|relative|absolute
270<clamptechnique> = drape|gpu|scene|map
271
272map layer add <layerName> feature <driver> <format> <typeName> <url> <cache> <styleLen> <?scriptLen?> <?selectorsLen?> <?terrainPatch?> <?visibilityRangeMin?> <?visibilityRangeMax?>
273    Data payload follows command: style, then script, then selectors
274    <styleLen> = Number of bytes in style sheet. Stylesheet payload consists of
275    CSS-formatted styles (see:
276    http://docs.osgearth.org/en/latest/user/features.html and
277    http://docs.osgearth.org/en/latest/references/symbology.html)
278    <scriptLen> = Number of bytes in scripts.  Scripts payload consists of
279    JavaScript code (see references above)
280    <selectorsLen> = Number of bytes in selectors.  Selectors payload consists
281    of a Tcl list of name/value pairs
282    <terrainPatch> = Boolean indicating if layer should be used for elevation
283    queries.
284map layer add <layerName> icon <driver> <format> <typeName> <url> <cache> <icon> <scale> <heading> <declutter> <placement> <alignment> <?visibilityRangeMin?> <?visibilityRangeMax?>
285    Add an icon feature layer from a file or URL
286    <placement> = vertex|centroid|interval|random
287    <alignment> = left_top|left_center|left_bottom|center_top|center_center|center_bottom|right_top|right_center|right_bottom
288map layer add <layerName> line <driver> <format> <typeName> <url> <cache> <r> <g> <b> <width> <?cap?> <?join?> <?stipplePattern?> <?stippleFactor?> <?clamping?> <?clamptechnique?> <?visibilityRangeMin?> <?visibilityRangeMax?>
289    Add a line feature layer from a file or URL
290    cap/join only used if width > 1
291    <cap> = flat|square|round
292    <join> = mitre|round
293map layer add <layerName> point <driver> <format> <typeName> <url> <cache> <r> <g> <b> <size> <?clamping?> <?clamptechnique?> <?visibilityRangeMin?> <?visibilityRangeMax?>
294    Add a point feature layer from a file or URL
295map layer add <layerName> polygon <driver> <format> <typeName> <url> <cache> <r> <g> <b> <?lineWidth?> <?strokeR?> <?strokeG?> <?strokeB?> <?clamping?> <?clamptechnique?> <?terrainPatch?> <?visibilityRangeMin?> <?visibilityRangeMax?>
296    Add a polygon feature layer from a file or URL
297map layer add <layerName> text <driver> <format> <typeName> <url> <cache> <content> <priority> <fgR> <fgG> <fgB> <bgR> <bgG> <bgB> <haloWidth> <fontSize> <declutter> <alignment> <xoffset> <yoffset> <?visibilityRangeMin?> <?visibilityRangeMax?>
298    Add a text symbol layer from a file or URL
299    <alignment> = left_top|left_center|left_bottom|center_top|center_center|center_bottom|right_top|right_center|right_bottom|left_baseline|center|baseline|right_baseline|left_bottom_baseline|center_bottom_baseline|right_bottom_baseline
300
301map layer add <layerName> mask <driver> <format> <typeName> <url> <?minLOD?>
302    Create a terrain mask layer to cut a hole in the terrain geometry.  The
303    first feature found is assumed to be a boundary polygon.
304    <driver> = db|ogr|tfs|wfs|wkt|wkt_file
305    <minLOD> minimum LOD to at which to apply the mask, defaults to 0.
306map layer add <layerName> mask wkt <format> <typeName> <length> <?minLOD?>
307    Like generic mask layer command, but instead of a <url>, included data in
308    the payload which is a WKT literal string.
309    <format> and <typeName> are unused
310    <length> = length of following data for inline WKT string
311map layer add <layerName> mask wkt_file <format> <typeName> <url> <?minLOD?>
312    <url> = URL for a text file containing a WKT string
313    <format> and <typeName> are unused
314
315map layer add <layerName> model simple <url> <x> <y> <?z?> <?rotx?> <?roty?> <?rotz?> <?terrainPatch?>
316    <url> = Path to a 3D model file that OSG can load (e.g. .osg file)
317    <x>,<y>,<z> = Map coordinates for placing the model
318    <rotx>,<roty>,<rotz> = Rotations (in degrees) to apply to orient model
319    <terrainPatch> = boolean indicating if model should be used for elevation
320    queries.
321
322map layer delete <layerName>
323map layer opacity <opacity> <layerName>
324map layer move <pos> <layerName>
325map layer names <?type?>
326    Generates a response listing the names of the given type (or all types if
327    not specified)
328    <type> = elevation|image|mask|model
329map layer visible <bool> <layerName>
330
331map load data follows <nbytes>
332    Send an .earth file over the wire
333map load file <path>
334    Load an .earth file from a filesystem mounted on the server
335map load url <url>
336    Load an .earth file from a network address
337
338map posdisp <bool> <?format?> <?precision?>
339    Toggle coordinate/position display, set format and precision
340    <format> = latlong_decimal_degrees|latlong_degrees_decimal_minutes|
341               latlong_degrees_minutes_seconds|mgrs
342    <precision> = integer number of digits to display
343
344map reset <type> <r> <g> <b> <?profile?> <?xmin?> <?ymin?> <?xmax?> <?ymax?>
345    Clear the scene and rebuild a new map from scratch.  When resetting the
346    map to geocentric, a profile and extents should be omitted.  When the map
347    type is projected, the profile is required and extents are optional.
348    <type> = geocentric|projected
349    <r>,<g>,<b> - Background color red, green and blue components [0,1]
350    <profile> = Well known profile string, e.g. 'global-geodetic',
351    'global-mercator'.  If specifying bounds (i.e. not global), use 'geodetic'
352    or 'spherical-mercator' or an SRS init string (such as an EPSG code)
353    xmin,ymin,xmax,ymax = map bounds (in profile projection/units)
354
355map scalebar <bool> <?units?>
356    Toggle scale label/bar
357    <units> = meters|feet|us_survey_feet|nautical_miles
358map setpos <x> <y>
359    Set the coordinate/position display based on mouse coordinates
360map terrain edges <bool>
361    *Not currently implemented*
362map terrain lighting <bool>
363map terrain linecolor <r> <g> <b>
364    *Not currently implemented*
365map terrain vertscale <val>
366    Set scale factor for terrain height
367map terrain wireframe <bool>
368map time <?hours?> <?day?> <?month?> <?year?>
369    Set ephemeris time for sky.  When args are omitted, set to current time.
370    Time is interpreted as UTC.
371
372================================================================================
373Replies:
374================================================================================
375nv>image -type image -bytes <nbytes>
376  <binary RGB data>
377nv>legend <colormapName> <rmin> <rmax> <nbytes>
378  <binary RGB data>
379nv>map coords <token> <mapCoordList> <?srs?> <?verticalDatum?>
380   Reply to query of map coordinates from screen coordinates.  The mapCoordList
381   is a list of x,y,z map coordinates.  The srs of the map coordinates may be
382   included if not in map's native coordinate system.  NaN in the results
383   indicates off-map input coordinates.
384nv> map names <list>
385   Reply to query of layer names.  <list> is a Tcl formatted list.
386nv>screen coords <token> <screenCoordList>
387   Reply to query of screen coordinates from map coordinates.  The
388   screenCoordList is a list of x,y,z screen coordinates (z is the depth).  NaN
389   in the results indicates a point outside the view frustum or invalid input
390   map coordinate
391nv>select annotation <guid> <annotationName>
392nv>select clear
393nv>select feature <guid> <featureIDList> <numFeatures> <layerName>
394nv>select region <xmin> <ymin> <xmax> <ymax>
395nv>ok -token <seqnum>
396   Reply indicated commands through <seqnum> (numbered beginning at 0) have been
397   processed, but no new image was rendered
398================================================================================
399Error Replies:
400================================================================================
401nv>viserror -bytes <nbytes>
402   <multi-line error string of nbytes>
403================================================================================
Note: See TracBrowser for help on using the repository browser.