Logger pageLoad Function

The map is loaded via the pageLoad function. The following is the pageLoad extract from the LoggerEmbedded.html.

Example
/**************************************** MAP CONTROL ****************************************/
function pageLoad ( evt ) {
 
   jQuery(   "input, select" ).keydown(function(event){
      event.stopPropagation();
   });
   
   var logger_options = { 
      'mapSource': 'Workshop/Logger',
      /*"view" : { 
         "easting": 498814,
         "northing": 163757, 
         "scale": 500
      },   
      'model': 'locationLookup',
      'suppressNoLocationMessage': true,
      'suppressViewAllAsset': true,
      'suppressAddToReport': true,
'reportOnDblClickScale' : 'inherit',
'selectNearestAsset' : false,
      'additionalHTML': {
         'casePopup': '<p><a href="notapageforcases.html?##caseid##">More information for ##caseid##</a></p>',
         'assetPopup': '<p><a href="notapageforassets.html?##assetid##">More information for ##description##</a></p>',
         'popup': '<p><a href="notapageforinformation.html">More information</a></p>'
      },
      "messages": {
         "placementScale" : "Please zoom further in to the map to set a location.",
         "newCase": "New Problem",
         "existingCase": "Reported Problem"
      },*/   
      'startup': {
         'type': jQuery( 'select#type' ).val(),
         'caseid': 'TEST9000'
      }
   } ;

Logger Options

mapSource

Here you specify Map Source which contains the layers to be displayed for Logger. This may be found by clicking on the Logger Options node in Studio and looking at the XML file name in the caption bar. E.g. If the caption says 'D:\astun\ishare\5.0\webapps\webservice\config\Workshopl\Logger.XML' then the mapSource value will be ‘Workshop/Logger’.

view

Specify the startup view for Logger by supplying an 'easting', 'northing' and 'scale'.

model

This will either be 'locationLookup' for non-asset layers or 'standard' for asset-based layers.

reportOnDblClickScale

From Version 5.2.4 - Determine whether double clicking on the map should be treated the same as clicking when the scale is larger than a given value. Possible values are 'inherit' or a literal scale such as 1000. If 'inherit' is specified the fault layer max report scale will be used as configured in Studio.

selectNearestAsset

From Version 5.2.4 -  When set to 'true' the users will not be prompted to choose from a list of candidate features if more than one is found where they click but instead the closest feature will be automatically selected.

For POINT asset layers the closest point in the asset layer is automatically selected and no additional configuration is required. For LINE and POLYGON asset layers some additional configuration is required in the map file so that features are returned sorted by distance from the point where the user clicks. This is achieved by using the mapxy parameter passed by MapServer when it queries for features at a point. A sample LAYER with a DATA clause that uses the mapxy parameter is shown below for a layer named "streets" in the iShare PostgreSQL database:

Example
LAYER
    NAME StreetsAssets
    TYPE LINE
    STATUS OFF
    CONNECTIONTYPE postgis
    CONNECTION "user=iShareData password=password dbname=iShareData host=localhost port=5432"
    # If a parameter called mapxy is included in the MapServer request then
    # return the feature closest to those coordinates, otherwise simply return all rows
    DATA "wkb_geometry from ( (SELECT * FROM streets WHERE trim(both '%' from '%mapxy%') = 'mapxy') UNION (SELECT * FROM streets WHERE trim(both '%' from '%mapxy%') != 'mapxy' ORDER BY ST_Distance(wkb_geometry, ST_PointFromText('POINT(' || CASE WHEN trim(both '%' from '%mapxy%') = 'mapxy' THEN '0 0' ELSE '%mapxy%' END || ')', 27700)) limit 1) ) as foo using unique ogc_fid using SRID=27700"
    CLASS
        STYLE
            COLOR 13 68 128
            WIDTH 4
        END
    END
END

 

The SQL in the DATA clause may look a little involved but in most cases for layers loaded into PostgreSQL via a Spatial Data Transformation Workflow Task you should only need to change the name of the Layer (in this example "streets"). The query will result in the features always being returned sorted on distance from either '0 0' or the coordinates passed in the special MapServer mapxy parameter if it's available (which will be the case when MapServer is asked for features at a point). There is a small performance overhead of the distance calculation and sorting but in practice it's not significant for most asset layers.

startup

The 'type' will either be a jQuery as above, in which case the Logger loadSelect Function will determine the Layers that may be selected, or an individual Layer name.