Drawing Multiple Map Layers

In this section:

In general, the information required to draw particular features on a map come from different structures within a database or even different databases.

Begin by creating a FOCEXEC with multiple TABLE requests. If you already have separate MAP type procedures, it will be easier to begin by combining the code from each into a single procedure. The filtering code is still necessary for each request. The filter list will be made available by the WebFOCUS GIS adapter based on the INBOUND layer definition.

Make sure that you uniquely name the rendering elements in each TABLE request. The rendering elements are the fields in the request associated with COLOR, SHAPE, SIZE and TITLE. An easy way of keeping track of each is to add the layer ID value to the end of the rendering element name.

TABLE FILE data_layer_1
PRINT colname1  
  COMPUTE COLOR1/A25='RED'; 
  COMPUTE TITLE1/A255='your title goes here for layer 1';
-*
-IF &FLTRLST1.EXIST NE 1 GOTO SKIP_FILT_1; 
  IF some_field EQ (&FLTRLST1)
-SKIP_FILT_1
-*\
ON TABLE PCHOLD FORMAT XML
END
-RUN
-*
TABLE FILE data_layer_2
PRINT colname2  
  COMPUTE COLOR2/A25='BLUE';  
  COMPUTE SIZE2/A3='10';  
  COMPUTE SHAPE2/A10='STAR';  
  COMPUTE TITLE2/A255='your title goes here for layer 2';
-*
-IF &FLTRLST2.EXIST NE 1 GOTO SKIP_FILT_2; 
  IF some_field EQ (&FLTRLST2)
-SKIP_FILT_2
-*
ON TABLE PCHOLD FORMAT XML
END

Open the definition editor and access the appropriate application. Create a configuration for a MAP type FOCEXEC. Depending on the particular data circumstances it may be necessary to create multiple INBOUND layer definitions. Create the multiple OUTBOUND layer definitions and associate the rendering elements with the appropriate layer in the definition.


Top of page

x
Drawing Identical Map Layers Using Alternative Methods

You may encounter situations that require you to show the same map feature with multiple rendering styles. For example, a polygon you want to display may be too small and difficult to visually locate on a map. However, adding a symbol, such as a star in a contrasting color could make it easier for the user to locate the feature.

Begin by creating a FOCEXEC with a single TABLE request. Create the fields you will associate with the layer to be rendered.

TABLE FILE data_layer
PRINT colname
-* Color for the POLYGON symbol
COMPUTE COLOR1/A12='RED';
-*
-* Color, shape, size for the POINT symbol
   COMPUTE COLOR2/A12='YELLOW';
   COMPUTE SHAPE2/A12='STAR';
   COMPUTE SIZE2/A12='15';
-*
   COMPUTE TITLE1/A255='your title goes here for the layer';
-*
-DEFAULT &FLTRLST2 = 'FOC_NONE';
...
WHERE some_field IN FILE &FLTRLST2;
-SKIP_FILT_1
-*ON TABLE PCHOLD FORMAT XML
END
-RUN

Make sure you use different names to keep the attributes correctly identified.

Using the definition editor, create the configuration for the FOCEXEC with duplicate outbound layer definitions. Specify a different SYMBOLID for each of the layer definitions.

In this example the first definition will use a POLYGON symbol. Associate the field COLOR1 to the COLOR attribute.

The second definition will use a POINT symbol. Associate the fields COLOR2, SHAPE2 and SIZE2 to the appropriate attributes. When you are finished, the XML definition will look like the following example.


WebFOCUS