Sf spat

From ARK
Jump to: navigation, search

These are some notes describing the sf_spat.

Description

sf_spat can be used to display a small map (or maps) of an item. It can also be used to display other spatial information (such as what trench a context is in for example)

Usage

This form can only be used if the mapping functionality is set up and properly configured.

Set-Up

sf_spat needs a number of different 'op' variables set in the sf_conf and also it will need some other settings set which are in the main settings .php file.

Examples

In this example, sf_spat is being used to display a map of a Special Find.

the sf_conf

 $conf_mcd_spat = 
   array(
       'view_state' => 'max',
       'edit_state' => 'view',
       'sf_nav_type' => 'full',
       'sf_title' => 'spat_data', //appears in the titlebar of the subform (mk nname)
       'sf_html_id' => 'sfi_spat_display',
       'script' => 'php/subforms/sf_spat.php',
       'op_geom_layers' => array(
                           'sf',
                           ),
 ); 

As you can see here this is a normal sf_conf setup except:

  • there are no fields
  • 'op_geom_layers' - this is an array of map layernames that will be searched by the Mapscript. They all need to have a field in their attribute table called 'ark_id' - that contains the itemvalue of the item that that shape represents

settings.php

These need to be set up within the main settings.php file in order for the sf_spat to work:

 //loaded map modules - these are the modules that have tables within the ark db  - 
 // this is used to    load up the default map layers (built from the database)
 $loaded_map_mods = array('cor',
                        'cxt',
                        'sfi',
                   );
 //spatial modules - these are the modules that have QUERYABLE geometry
 $spat_mods = array('cxt','sfi');

mod_settings.php

 //decide if you want to show a reference map when the spatial subform is in primary column
   $refmap_show = TRUE;
 //set this to TRUE if you want the maps to display on default, else leave as FALSE
 $view_map_default = TRU
 //This is for setting up the params from the reference map
 $refmap_type = 'SCALE'; //choose if you want to zoom to 'SCALE' or 'SHAPE' - 
 //i.e. if you want to   always have the ref map zoomed to a set scale or if you
 //want it to zoom the outline of a specific shape
 $refmap_scale = 500; //leave this NULL if you are zooming to a shape, 
 //else use an int i.e. 500 for 1:500
 $refmap_width = 200; // (OPTIONAL) this is an optional value for specifiying a non-default width 
 //(if not specified the value is taken from the $map object)
 $refmap_height = 200; // (OPTIONAL) this is an optional value for specifiying a non-default 
 //height (if not specified the value is taken from the $map object)
 $refmap_layer = NULL; //OPTIONAL (only should be used if zoomtype SHAPE is stated)  - the name of 
 //the layer to zoom to
 $refmap_field = NULL; //OPTIONAL (only should be used if zoomtype SHAPE  is stated)  - the name 
 //of attribute field of the shape to zoom to
 $refmap_fieldvalue = NULL; //OPTIONAL (only should be used if zoomtype SHAPE is stated)  - the 
 //value in the attribute field of the shape to zoom to