Overview
The LAS product server is typically used to generate images. Along with those images, various other files are saved in the output/ directory including -- if the operations requests it -- information describing the relationship between pixels on the image and the real world coordinates they represent. This information is stored in an xml file in the output/ directory as 'unique_ID_map_scale'.
This information is particularly useful to client pages that use javascript to create clickable or rubber-bandable maps from the LAS images.
Requesting map_scale results in operationsV7.xml
In order to take advantage of this capability, each operation that wishes to access the ~_map_scale response must request that it be generated by listing it in the <response ...> section of the definition of the operation in operationsV7.xml. Here is an example:
<operation name="Color plot" ID="Plot_2D_XY" output_template="output" service_action="Plot_2D_XY" order="0100">
<service>ferret</service>
<response ID="PlotResp">
<result type="image" ID="plot_image" streamable="true" mime_type="image/png" file_suffix=".gif" />
<result type="ps" ID="plot_postscript" streamable="true" mime_type="application/postscript" file_suffix=".ps"/>
<result type="image" ID="ref_map" file_suffix=".gif" />
<result type="map_scale" ID="map_scale" file_suffix=".xml"/>
<result type="debug" ID="debug" file_suffix=".txt"/>
<result type="cancel" ID="cancel" file_suffix=".txt"/>
</response>
<region>
<intervals name="xy" />
</region>
<grid_types>
<grid_type name="regular" />
</grid_types>
<optiondef IDREF="Options_2D_image_contour_xy"/>
</operation>
The map_scale.xml file
When LAS prforms an operation that requests a map_scale result a file similar to the following will be found in the output/ directory:
<?xml version="1.0" encoding="UTF-8"?>
<map_scale>
<x_pixels_per_inch>63.627453</x_pixels_per_inch>
<y_pixels_per_inch>63.636364</y_pixels_per_inch>
<x_image_size>649.0</x_image_size>
<y_image_size>560.0</y_image_size>
<x_plot_size>484.52304</x_plot_size>
<y_plot_size>389.07272</y_plot_size>
<x_offset_from_left>76.35294</x_offset_from_left>
<y_offset_from_bottom>89.09091</y_offset_from_bottom>
<x_offset_from_right>63.627453</x_offset_from_right>
<y_offset_from_top>89.09091</y_offset_from_top>
<x_axis_lower_left>144.8438</x_axis_lower_left>
<y_axis_lower_left>0.0</y_axis_lower_left>
<x_axis_upper_right>182.5</x_axis_upper_right>
<y_axis_upper_right>5000.0</y_axis_upper_right>
<axis_horizontal>x</axis_horizontal>
<axis_vertical>z</axis_vertical>
<axis_vertical_positive>down</axis_vertical_positive>
<axis_horizontal_positive />
<data_min>1.464</data_min>
<data_max>15.67</data_max>
<data_exists>1</data_exists>
<xstride>1</xstride>
<ystride>1</ystride>
</map_scale>
The elements defined in <map_scale> have the following interpretation:
- x_pixels_per_inch
- number of pixels per 'virtual inch' on the device generating the plot. This values is not very useful to developers.
- y_pixels_per_inch
- See above.
- x_image_size
- width in pixels of the image
- y_image_size
- height in pixels of the image
- x_plot_size
- width in pixels of the plotted area excluding margins on the left and right.
- y_plot_size
- height in pixels of the plotted area excluding margins on the top and bottom.
- x_offset_from_left
- number of pixels between the left edge of the image and the left edge of the plotted area (equivalent to the left margin width)
- y_offset_from_bottom
- number of pixels between the bottom of the image and the bottom edge of the plotted area (equivalent to the bottom margin height)
- x_offset_from_right
- number of pixels between the right edge of the image and the right edge of the plotted area (equivalent to the right margin width)
- y_offset_from_top
- number of pixels between the top of the image and the top edge ofthe plotted area (equivalent to the top margin height)
- x_axis_lower_left
- world coordinate X value associated with the lower left corner of the plotted area (for XY maps = westernmost longitude)
- y_axis_lower_left
- world coordinate & value associated with the lower left corner of the plotted area (for XY maps = southernmost latitude)
- x_axis_upper_right
- world coordinate X value associated with the upper right corner of the plotted area (for XY maps = easternmost longitude)
- y_axis_upper_right
- world coordinate & value associated with the upper right corner of the plotted area (for XY maps = northernmost latitude)
- axis_horizontal
- which axis (x, y, z, or t) is represented by the horizontal axis of the image
- axis_vertical
- which axis (x, y, z, or t) is represented by the vertical axis of the image
- axis_vertical
- which axis (x, y, z, or t) is represented by the vertical axis of the image
- axis_horizontal_positive
- if the axis has a positive-downwards attribute (e.g. represents depth) that is listed here
- axis_vertical_positive
- if the axis has a positive-downwards attribute (e.g. represents depth) that is listed here
- data_min
- the minimum value of data in the variable
- data_max
- the maximum value of data in the variable
- data_exists
- 1 if there was valid data, 0 if there was no valid data
- xstride
- striding (decimation by keeping every nth point) in the horizontal direction, value is 1 if no striding was done
- ystride
- striding (decimation by keeping every nth point) in the horizontal direction, value is 1 if no striding was done
Using map_scale information in a Velocity template
In order to create a clickable or rubber-bandable product you will need to access these values inside a Velocity template. The entire map_scale class is available within the Velocity template context as seen in the following snippet:
...
'plot_area' : { // defining the plot region within the image
'offX' : $las_map_scale.getXOffsetFromLeft(),
'offY' : $las_map_scale.getYOffsetFromTop(),
'width' : $las_map_scale.getXPlotSize(),
'height' : $las_map_scale.getYPlotSize()
},
...
Each element of the map_scale object has a getter method whose name is the CamelCase, no-underscore version of the XML element name.