SMap

From TechWiki

Jump to: navigation, search

Contents

Introduction

The sMap component is used to display cartographic information related to a record. The cartographic information comes from a GIS shape file. This shape file is compressed by the ClearMaps Builder Air application. The generated map file is then loaded by this component.

A record that is related to such a GIS map file is normally represented by a feature within the map. Multiple features can belong to that map, and each feature can represent different records. Each feature can be selectable and clickable.

Generating GIS Maps

GIS ShapeFiles can be generated from any GIS software. A good opensource GIS software is Quantum GIS. Once the GIS file is created with all the features, it can be converted into a ".map" file that is then used by the sMap component. This map is created by ClearMaps Builder Air application.

Finally, to trigger the use of the sMap, a record has to be described using the predicate/attribute of the input schema that is described as <displayControl>sMap</displayControl>, and that has the URL of the file of the map representation as its record value.

Each shapefile that is converted should have a EXTURI column in its related dBase data file. The value of this attribute is the "extension" part of the URI of a record (what get appended to the base URI when building the URIs of the records of a structWSF instance). When this EXTURI is appended to the recordBaseUri setting of the sMap component, this creates the full URI of the record. Since all features of a map should be a record in a dataset, it is why we re-create a URI reference for each feature. However, some times there will not be a record description for some feature. In those cases, you should leave an empty value for that feature row in the dBase file of the map.

Each shapefile should have a PREFLABEL column, this is the value that the sMap control uses to display tooltips when the mouse is moved above any feature.

Features

The GIS file is normally related to a row/column data structure where each row is a feature, and each column an attribute describing a feature. This data model is embedded in the GIS shape file, and converted (and manipulable) by the ClearMaps Builder Air application. This simple data structure is then converted into Flex objects, and each column/value is accessible from the "data" property of a Feature object.

Take a look at how the Portable Control Application implements the events. Use that data structure as guidance to perform different actions when a user interacts with the map.

Important Predicates

Some predicates/attributes describing a record are important for this map component. This is a list of those important predicates and their usage in the context of the sMap component.

Prefixed Attribute Predicate URI Usage
geoname_name http://www.geonames.org/ontology#name This attribute is used by the sMap component to display the name of the feature (usually the name of a record on the map).
gisMapAttribute - TBD by the configuration file gisMapAttribute - TBD by the configuration file Name of the attribute used to link a record to its main GIS map layer. The record is supposed to be part of this map.
sco_gisMap sco_gisMap Reference to a map binary file created created from a ShapeFile map file and ClearMapsBuilder. The referenced map file is a serialized ActionScript object.

The sco:gisMap defines the first layout that is related to a given resource. Normally, this resource is part of the map related by the gisMap predicate. Read more about maps in the sMap documentation page.

There is only one gisMap relationship per resource, other relationships should be made with the sco:relatedGisMap predicate.

sco_relatedGisMap sco_relatedGisMap Reference to a map binary file created created from a ShapeFile map file and ClearMapsBuilder. The referenced map file is a serialized ActionScript object.

The sco:relatedGisMap defines a related map layout that is related to a given resource. The resource is related to that map layer in some ways, but it is not a necessary part of the layer. Read more about maps in the sMap documentation page.

Interacting with the sMap Control

There are two ways to interact with a sMap control: when a feature is selected in the layout, and when the mouse moves over or away from a feature. These events are represented by:

  • FeatureEvent.FEATURE_SELECTED
  • FeatureEvent.FEATURE_OVER
  • FeatureEvent.FEATURE_OUT

These events are bubbling, so the parent component(s) can attach to these events to do something particular depending what the user does.

Styles

Style Name Description
sMap Style for the main sMap component

AS3 Usage Examples

  /** Create a resultset object instance from the input structXML data */
  var resultset:Resultset = new Resultset(XML(inputData));

  /** Create the sMap component */
  var semanticMap:sMap = new sMap();

  /** Initialize the semantic control */
  semanticMap.percentWidth = 100;
  semanticMap.percentHeight = 100;
  semanticMap.semanticDataProvider = resultset;

  /** Add the sMap to the main application
  this.addChild(semanticMap);

MXML Usage Examples

  <sMap semanticDataProvider="{semanticDataProvider}"
       targetAttributes="{targetAttributes}" />

In this example, we assume that the {semanticDataProvider} variable is a Resultset, where the record description is defined, accessible at the creation time of the sMap. We also consider that the targetAttribute variable is an array of at least one attribute that is defined to be a displayControl "sMap" in the schema used by the application.

Related Libraries

This tool is based on the ClearMaps Flex mapping project. It has been enhanced for some special purposes of the Semantic Component, but the basis of this component is based on the ClearMap application.

It also uses the ClearMap Air application that creates the map files used by this component.

Personal tools