calcrgn
The calcrgn
command performs geometry calculations helpful for creating dynamic, zoomable images in web pages.
Given the current region of an image and the width and height in which it is displayed, this function will interpret a command (zoomin, zoomout, or pan), and an offset, and will calculate the next region.
The calcrgn
command may be invoked in several ways.
The following calculates the exact region of the image that will fill the specified dimensions exactly:
calcrgn?cat=<catalog-name>&item=<itemid>&rgn=<left,top,right,bottom>&wid=<pixels>&hei=<pixels>
The following calculates the exact region of the image that will fill the specified dimensions exactly, given the current region and the specified command:
calcrgn?cat=<catalog-name>&item=<itemid>&rgn=<left,top,right,bottom>&wid=<pixels>&hei=<pixels>&cmd=<command>
The following parameters may be used with the calcrgn
command:
The catalog name.
The ID of the item to browse. The
itemid
is the folder path to the item plus the item name (oriserv-catalog-index
, which specifies the spatial index).
The current region of the source image. This is specified in resolution independent coordinates, unless the parameter
geo=true
is also present, in which case it is expressed in geospatial coordinates.
If present and set to "true", then the coordinates expressed in
rgn
are interpreted as geospatial coordinates. If not present or set to false, then the coordinates are interpreted as resolution independent.
A command to perform. May be empty, or one of the following values: pan, zoomin, zoomout.
The width and height, in pixels, in which it is desired to fit the specified region.
These represent an offset, in pixels, from the upper left hand corner of the portion of the image specified by
rgn
andwid
andhei
. These correspond to the coordinates sent up by web browsers in response to mouse clicks on an image.
List of item and catalog properties to display in the results. The syntax is
props=item(<prop>,<prop>,…),cat(<prop>,<prop>,…)
NOTE: It is possible to specify which item and catalog props are returned in
catalogs.xml
rather than specifying it in the URL for each query. See the catalog configuration section.
XSL style sheet to be used when formatting the data for display. Refers to a directory or file in
<Express Server installation directory>/ImageServer/docs/styles
. If this value is missing, then the default stylesheet is assumed. An XML processing instruction will be inserted into the response which specifies the URL of the stylesheet to use when displaying this document. A special value of "none
" specifies that no XSL stylesheet should be used.
The following examples are "live" in that they contain real URLs that will access an Express Server. Change the hostname to your host to see your own server's responses to these queries.
The following will return an XML document containing the exact region of the image that will fit best within the specified dimensions.
http://demo.lizardtech.com/lizardtech/iserv/calcrgn?cat=Geo&item=BLM_relief.sid&wid=400&hei=400&rgn=0,0,1,1&style=none
The following will get the same data, formatted with the stylesheet simple/view.xsl
.
http://demo.lizardtech.com/lizardtech/iserv/calcrgn?cat=Geo&item=BLM_relief.sid&wid=400&hei=400&rgn=0,0,1,1&style=simple/view.xsl
The following returns the same as the above, with the addition of a "zoomin" command.
http://demo.lizardtech.com/lizardtech/iserv/calcrgn?cat=Geo&item=BLM_relief.sid&wid=400&hei=400&rgn=0,0,1,1&style=simple/view.xsl&cmd=zoomin