Skip Headers

Oracle® Application Server 10g MapViewer User's Guide
10g (9.0.4)

Part Number B10559-01
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

2
MapViewer Concepts

This chapter explains concepts that you should be familiar with before using MapViewer.

The fundamental concepts are style, theme, base map, mapping metadata, and map.

2.1 Overview

When an application uses MapViewer, it applies specific styles (such as colors and patterns) to specific themes (that is, collections of spatial features, such as cities, rivers, and highways) to render a map (such as a GIF image for display on a Web page). For example, the application might display a map in which state parks appear in green and restaurants are marked by red stars. A map typically has several themes representing political or physical entities, or both. For example, a map might show national and state boundaries, cities, mountain ranges, rivers, and historic sites. When the map is rendered, each theme represents a layer in the complete image.

MapViewer lets you define styles, themes, and base maps, including the rules for applying one or more styles to each theme. These styles, themes, base maps, and associated rules are stored in the database in map definition tables under the MDSYS schema, and they are visible to you through metadata views. All styles in a database instance are shared by all users. The mapping metadata (the set of styles, themes, and base maps) that you can access is determined by the MapViewer metadata views described in Section 2.5 (for example, USER_SDO_STYLES, USER_SDO_THEMES, and USER_SDO_MAPS). The set of map definition objects that a given user can access is sometimes called that user's mapping profile. You can manage styles, themes, and base maps with the Map Definition Tool, described in Chapter 7.

2.2 Styles

A style is a visual attribute that can be used to represent a spatial feature. The basic map symbols and labels for representing point, line, and area features are defined and stored as individual styles. Each style has a unique name and defines one or more graphical elements in an XML syntax.

Each style is of one of the following types:

Table 2-1 lists the Java class for creating styles of each type.

Table 2-1  Style Types and Associated Java Classes
Style Type Java Class Applicable Geometry Types

Color

oracle.sdovis.style.StyleColor

(any type)

Marker

oracle.sdovis.style.StyleMarker

point, line

Line

oracle.sdovis.style.StyleLine

line

Area

oracle.sdovis.style.StyleArea

polygon

Text

oracle.sdovis.style.StyleText

(any type)

Advanced

oracle.sdovis.stylex.AdvancedStyle and extensions

(any type)

All styles for a database user are stored in that user's USER_SDO_STYLES view, which is described in Section 2.5 and Section 2.5.3.

For more detailed information about the types of styles, including information about the XML format for defining each type, see Appendix A.

2.3 Themes

A theme is a visual representation of a particular data layer. Each theme (except for image themes) is associated with a specific spatial geometry layer, that is, with a column of type MDSYS.SDO_GEOMETRY in a table or view. For example, a theme named US_States might be associated with the STATE_SHAPE spatial geometry column in a STATES table.

A theme can have its definition, including styling rules, stored permanently in the database (a predefined theme), or a theme can be dynamically defined with a map request (a JDBC theme).

All predefined themes for a database user are stored in that user's USER_SDO_THEMES view, which is described in Section 2.5 and Section 2.5.2.

2.3.1 Styling Rules in Predefined Themes

Each predefined theme is associated with one or more styling rules. The styling rules for each predefined theme are expressed using XML, such as in Example 2-1 for an Airport theme.


Notes:

The following naming conventions are used for "prefixes" in style names in the examples in this chapter: v. indicates variable (advanced style), m. indicates marker, c. indicates color, l. indicates line, and t. indicates text.

In the content (character data) of an XML document, &lt; and &gt; must be used to represent < and >, respectively. Otherwise, < or >, such as in WHERE CATEGORY > 'B', will be interpreted by the XML parser as part of an XML tag.


Example 2-1 XML Definition of Styling Rules for an Airport Theme

<?xml version="1.0" standalone="yes"?>
<styling_rules>
  <rule>
    <features style="c.black gray">
    runway_number &gt; 1
    </features>
    <label column="name" style="t.airport name">
      1
    </label>
  </rule>
  <rule>
    <features style="m.airplane">
    runway_number = 1
    </features>
  </rule>
</styling_rules>

Each styling rule has a required <features> element and an optional <label> element. The <features> element specifies which rows (features) in the table or view will be selected based on its attribute value, and the style to be used for those selected features. The <label> element specifies whether or not to annotate the selected feature, and if so, which column in the table or view to use for text labels.

In Example 2-1, there are two styling rules associated with the Airport theme:

If two or more rules are specified, a UNION ALL operation is performed on the SQL queries for the rules (from first to last) to fetch the qualified features from the table or view.

If an advanced style is specified in a rule, the SELECT list of the query to fetch qualified features contains the spatial column, the attribute column or columns, the name of the feature style, the label information, the WHERE clause, and the feature query. Based on the value of the attribute column or columns and the definition of the specified feature style, each feature is associated with a style.

2.3.2 JDBC Themes

A JDBC theme is a theme that is dynamically defined with a map request. JDBC themes are not stored permanently in the database, as is done with predefined themes.

For a JDBC theme, you must specify a valid SQL query that retrieves one or more geometries from the database. You can also specify a rendering style and labeling style, to be used if you also selected text values in the query that can be used for labeling the geometries.

Example 2-2 is a map request that includes a JDBC theme.

Example 2-2 JDBC Theme in a Map Request

<?xml version="1.0" standalone="yes"?>
<map_request title="My MAP" datasource = "mvdemo">

  <themes>
    <theme name="jdbc_theme_1">
       <jdbc_query
            datasource="mvdemo"
            jdbc_srid="41052"
            spatial_column="geometry"
            render_style="C.RED">
          SELECT geometry from states where name='MA' 
       </jdbc_query>
     </theme>
  </themes>

</map_request> 

The full query that MapViewer executes for the JDBC theme in Example 2-2 is:

SELECT geometry FROM states WHERE name='MA';

For this request, MapViewer generates a map that contains only the selected geometry as a result of executing this JDBC theme's query. In a more typical case, however, the map request will need to use several JDBC themes to plot additional dynamic data on top of the base map. Furthermore, the map request may have a query window associated with it; that is, the user may want to see only a portion of the area included in the whole base map. In this case, the SQL queries in the JDBC themes will be subjected to a spatial window query, to eliminate any unwanted results.

For more information about JDBC themes, see the information about the <jdbc_query> element in Section 3.2.7.

2.3.2.1 Storing Complex JDBC Themes in the Database

Sometimes the SQL query for a JDBC theme is so complex that you may want to save the query. In such cases, you can define a predefined theme (whose definition is stored in the database's USER_SDO_THEMES view), and then include the full SQL query as the content of the <features> element in the styling rules for that theme.

The feature style specified in the <features> element is then used to render the geometries retrieved using the full query. The base table as defined for such a theme is ignored because the full SQL query already includes a FROM clause. The geometry column defined in the USER_SDO_THEMES view is still needed, and it must be the same as the geometry column selected in the user-supplied SQL query. If you have a <label> element for a styling rule, the label style specified is used to label the geometries, as long as the query selects a column that contains label text.

Example 2-3 is a sample <styling_rules> element of a predefined theme with a complex SQL query.

Example 2-3 Complex Query in a Predefined Theme

<?xml version="1.0" standalone="yes"?>
 <styling_rules>
   <rule>
     <features style="L.POOR_ROADS" asis="true">
        select sdo_lrs.clip_geom_segment(geometry,start_measure,end_measure)
              geometry 
        from (select /*+ no_merge use_hash(a b) */
                a.street_id, name, start_measure, end_measure, geometry
             from (select /*+ no_merge */ a.street_id, name, geometry
                   from philly_roads a
                   where sdo_filter(geometry,mdsys.sdo_geometry(2002,41124,null,
                    mdsys.sdo_elem_info_array(1,2,1),
                                       mdsys.sdo_ordinate_array(?,?,?,?)),
                                 'querytype=window')='TRUE') a,
                   philly_road_conditions b
             where condition='POOR' and a.street_id = b.street_id)
     </features>
   </rule>
 </styling_rules>

Even though Example 2-3 is defined as a predefined theme, MapViewer still treats it as a JDBC theme at runtime when a user requests a map that includes this theme. As with a normal JDBC theme, MapViewer by default imposes a window filtering process (if a query window was included in the map request) on top of the SQL query. To override this default behavior and have the supplied query string executed without any modification, specify asis="true" in the <features> element, as shown in Example 2-3. (For information about the asis attribute, see Section 3.2.7.)

2.3.3 Thematic Mapping

Thematic mapping refers to the drawing of spatial features based on their attribute values. MapViewer uses thematic mapping to create maps in which colors or symbols are applied to features to indicate their attributes. For example, a Counties theme can be drawn using colors with different hues that map directly with the population density of each county, or an Earthquakes theme can be plotted with filled circles whose sizes map to the scale or damage of each earthquake.

To achieve thematic mapping, specify advanced styles in the styling rules associated with a theme. You must specify attribute columns in the table or view whose values will be used to determine exactly how a feature will be rendered thematically. Example 2-4 is the XML definition for an Earthquakes theme.

Example 2-4 XML Definition of Styling Rules for an Earthquakes Theme

<?xml version="1.0" standalone="yes"?> 
<styling_rules theme_type="nature"> 
  <rule column="RICHTER_SCALE"> 
    <features style="v.earthquakes"> 
    </features> 
  </rule> 
</styling_rules>

The theme in Example 2-4 has only one rule. The <rule> element includes an attribute named column that does not appear in the Airport theme in Example 2-1. The column attribute specifies one or more columns (comma-separated) that provide the attribute values needed for thematic mapping. The style specified for the features element is named v.earthquakes, and it is an advanced style.

Another part of the definition of the Earthquakes theme specifies the table that contains the data to be rendered. This table must contain a column named RICHTER_SCALE in addition to a column (of type SDO_GEOMETRY) for the spatial data. (The table and the column of type SDO_GEOMETRY must be identified in the BASE_TABLE and GEOMETRY_COLUMN columns, respectively, of the USER_SDO_THEMES view, which is described in Section 2.5.2.) The RICHTER_SCALE column must be of type NUMBER. To understand why, look at the advanced style definition in Example 2-5.

Example 2-5 Advanced Style Definition for Earthquakes Theme

<?xml version="1.0" ?> 
<AdvancedStyle> 
  <VariableMarkerStyle basemarker="m.circle" startsize="7" increment="4" > 
     <Buckets> 
          <RangedBucket seq="0"  label="less than 4"  high="4" /> 
          <RangedBucket seq="1"  label="4 - 5" low="4" high="5" /> 
          <RangedBucket seq="2"  label="5 - 6" low="5" high="6" /> 
          <RangedBucket seq="3"  label="6 - 7" low="6" high="7" /> 
          <RangedBucket seq="4"  label="7 and up" low="7" /> 
      </Buckets> 
  </VariableMarkerStyle> 
</AdvancedStyle> 

This style specifies that the marker named m.circle is used to indicate the location of an earthquake. The size of the marker to be rendered for an earthquake depends on the numeric value of the RICHTER_SCALE column for that row. In this example there are five buckets, each covering a predetermined range of values. For example, if an earthquake is of magnitude 5.7 on the Richter scale, the marker size will be 15 pixels (7 + 4 + 4), because the value 5.7 falls in the third bucket (5 - 6) and the starting marker size is 7 pixels (startsize="7") with an increment of 4 for each range (increment="4").


Note:

The label attribute value (for example, label="less than 4") is not displayed on the map, but is used only in a label that is compiled for an advanced style.

The seq attribute value (for example, seq="0") is ignored by MapViewer, which determines sequence only by the order in which elements appear in a definition.


Example 2-5 used the <VariableMarkerStyle> tag. The following examples use the <ColorSchemeStyle> tag in creating thematic maps of census blocks in California. Example 2-6 illustrates the use of a graduated color scale for a thematic mapping of population density. Example 2-7 is a thematic mapping of average household income using a graduated color scale. Example 2-8 is also a thematic mapping of average household income, but it uses a specific color style for each income range rather a graduated scale.

Example 2-6 Mapping Population Density Using a Graduated Color Scheme

# ca pop density usbg_hhinfo 
<?xml version="1.0" standalone="yes"?> 
<styling_rules theme_type="political"> 
<rule column="densitycy"> 
   <features style="v.CA Pop density"> 
   </features> 
 </rule> 
</styling_rules> 

The table named USBG_HHINFO includes columns named DENSITYCY (used in Example 2-6). The definition of the style (v.CA Pop density) that corresponds to this population density theme is as follows:

<?xml version="1.0" ?> 
<AdvancedStyle> 
  <ColorSchemeStyle basecolor="#ffff00" strokecolor="#00aaaa"> 
     <Buckets low="0.0" high="20000.0" nbuckets="10" /> 
  </ColorSchemeStyle> 
</AdvancedStyle> 

The base color (basecolor) and the stroke color (strokecolor) are 24-bit RGB (red-green-blue) values specified using a hexadecimal notation. The base color value is used for the first bucket. The color value for each subsequent bucket is obtained by first converting the base color from the RGB to the HSB (hue-saturation-brightness) model and then reducing the brightness by a fixed increment for each bucket. Thus, the first bucket is the brightest and the last is the darkest.

As in Example 2-6, Example 2-7 illustrates the use of a base color and a graduated color scheme, this time to show household income.

Example 2-7 Mapping Average Household Income Using a Graduated Color Scheme

<?xml version="1.0" standalone="yes"?> 
<!-- # ca hh income theme  table = usbg_hhinfo  --> 
<styling_rules> 
<rule column="avghhicy"> 
   <features style="v.ca income"> 
   </features> 
 </rule> 
</styling_rules> 

The table named USBG_HHINFO includes a column named AVGHHICY (used in Example 2-7 and Example 2-8). The definition of the style (v.ca income) that corresponds to this average household income theme is as follows:

<?xml version="1.0" ?> 
<AdvancedStyle> 
  <ColorSchemeStyle basecolor="#ffff00" strokecolor="#00aaaa" > 
  <!-- # income range with a color gradient --> 
     <Buckets> 
          <RangedBucket seq="0" label="less than 10k"  high="10000" /> 
          <RangedBucket seq="1" label="10-15k" low="10000" high="15000" /> 
          <RangedBucket seq="2" label="15-20k" low="15000" high="20000" /> 
          <RangedBucket seq="3" label="20-25k" low="20000" high="25000" /> 
          <RangedBucket seq="4" label="25-35k" low="25000" high="35000" /> 
          <RangedBucket seq="5" label="35-50k" low="35000" high="50000" /> 
          <RangedBucket seq="6" label="50-75k" low="50000" high="75000" /> 
          <RangedBucket seq="7" label="75-100k" low="75000" high="100000" /> 
          <RangedBucket seq="8" label="100-125k" low="100000" high="125000" />
          <RangedBucket seq="9" label="125-150k" low="125000" high="150000" />
          <RangedBucket seq="10" label="150-250k" low="150000" high="250000" />
          <RangedBucket seq="11" label="250-500k" low="250000" high="500000" />
          <RangedBucket seq="12" label="500k and up"   low="500000" />
      </Buckets> 
  </ColorSchemeStyle> 
</AdvancedStyle> 

For individual range-based buckets, the lower-bound value is inclusive, while the upper-bound value is exclusive (except for the range that has values greater than any value in the other ranges; its upper-bound value is inclusive). No range is allowed to have a range of values that overlaps values in other ranges.

Example 2-8 uses specific color styles for each average household income range.

Example 2-8 Mapping Average Household Income Using a Color for Each Income Range

<?xml version="1.0" standalone="yes"?> 
<!-- # ca hh income theme  table = usbg_hhinfo  --> 
<styling_rules> 
<rule column="avghhicy"> 
   <features style="v.ca income 2"> 
   </features> 
 </rule> 
</styling_rules> 

The definition of the v.ca income 2 style is as follows:

<?xml version="1.0" ?>
<AdvancedStyle>
 <BucketStyle>
  <Buckets>
   <!-- # income ranges with specific colors -->
   <RangedBucket seq="0" label="less than 10k"  high="10000" style="c.rb13_1" />
   <RangedBucket seq="1" label="10-15k" low="10000" high="15000" style="c.rb13_2"/>
   <RangedBucket seq="2" label="15-20k" low="15000" high="20000" style="c.rb13_3"/>
   <RangedBucket seq="3" label="20-25k" low="20000" high="25000" style="c.rb13_4"/>
   <RangedBucket seq="4" label="25-35k" low="25000" high="35000" style="c.rb13_5"/>
   <RangedBucket seq="5" label="35-50k" low="35000" high="50000" style="c.rb13_6"/>
   <RangedBucket seq="6" label="50-75k" low="50000" high="75000" style="c.rb13_7"/>
   <RangedBucket seq="7" label="75-100k" low="75000" high="100000" style="c.rb13_8"/>
   <RangedBucket seq="8" label="100-125k" low="100000" high="125000" style="c.rb13_9"/>
   <RangedBucket seq="9" label="125-150k" low="125000" high="150000" style="c.rb13_10"/>
   <RangedBucket seq="10" label="150-250k" low="150000" high="250000" style="c.rb13_11"/>
   <RangedBucket seq="11" label="250-350k" low="250000" high="350000" style="c.rb13_12"/>
   <RangedBucket seq="12" label="350k and up"   low="350000" style="c.rb13_13"/>
  </Buckets>
 </BucketStyle>
</AdvancedStyle>

Each <RangedBucket> definition has a specified style.

The following examples create an advanced style to identify gasoline stations operated by different oil companies, and a theme that uses the style. A <CollectionBucket> tag is used to associate a column value (Shell; Esso; Texaco; BP; any of Avia, Benzinex, Q8, Total, Witte Pomp; and all others for a default category) with a style appropriate for that company's stations, as shown in Example 2-9.

Example 2-9 Advanced Style Definition for Gasoline Stations Theme

<?xml version="1.0" ?> 
<AdvancedStyle> 
<BucketStyle> 
 <Buckets> 
  <CollectionBucket seq="0" label="Shell" style="m.shell gasstation"> 
   Shell 
  </CollectionBucket> 
  <CollectionBucket seq="1" label="Esso" style="m.esso gasstation"> 
   Esso 
  </CollectionBucket> 
  <CollectionBucket seq="2" label="Texaco"  style="m.texaco gasstation"> 
   Texaco 
 </CollectionBucket> 
  <CollectionBucket seq="3" label="BP"  style="m.bp gasstation"> 
   BP 
  </CollectionBucket> 
  <CollectionBucket seq="4" label="Other"  style="m.generic gasstation"> 
   Avia,Benzinex,Q8,Total,Witte Pomp 
  </CollectionBucket> 
  <CollectionBucket seq="5" label="DEFAULT" style="m.default gasstation">
   #DEFAULT#
  </CollectionBucket>
  </Buckets>
</BucketStyle> 
</AdvancedStyle> 

Notes on Example 2-9:

A theme (theme_gasstation) is then defined that specifies the column (MERK) in the table that contains company names. The styling rules of the theme are shown in Example 2-10.

Example 2-10 Styling Rules of Theme Definition for Gasoline Stations

<?xml version="1.0" standalone="yes"?> 
<styling_rules> 
  <rule column="merk"> 
    <features style="v.gasstations"> 
    </features> 
    <label column="merk" style="t.SansSerif red 10"> 
      1 
    </label> 
  </rule> 
</styling_rules> 

This theme depends on a table named NED_GASSTATIONS, which has the columns shown in Table 2-2 (with column names reflecting the fact that the developer's language is Dutch).

Table 2-2  Table Used with Gasoline Stations Theme
Column Data Type

FID

NOT NULL NUMBER

ID

NUMBER

NAAM

VARCHAR2(31)

STRAAT_

VARCHAR2(30)

NR

NUMBER

TV

VARCHAR2(1)

AAND

VARCHAR2(2)

PCODE

VARCHAR2(6)

PLAATS

VARCHAR2(10)

GEOM

MDSYS.SDO_GEOMETRY

MERK

VARCHAR2(40)

In this table, the GEOM column contains spatial geometries, and the MERK column contains company names (Shell, Esso, and so on).

The styling rules for the theme_gasstation theme specify that the marker (style v.gasstations) at a location specified by the content of the GEOM column is determined by the value of the MERK column for that row. The style v.gasstations (see Example 2-9) specifies that if the column value is Shell, use the style m.shell gasstation; if the column value is Esso, use the style m.esso gasstation; and so on, including if the column value is any one of Avia, Benzinex, Q8, Total, and Witte Pomp, use the style m.generic gasstation; and if the column value is none of the preceding, use the style m.default gasstation.

2.3.4 Image Themes

An image theme is a special kind of MapViewer theme useful for visualizing geographically referenced imagery (raster) data, such as from remote sensing and aerial photography.

You can define an image theme dynamically or permanently (as a predefined theme) in the database. You can use image themes with vector (non-image) themes in a map. Figure 2-1 shows a map in which an image theme (showing an aerial photograph of part of the city of Boston) is overlaid with themes showing several kinds of roadways in the city.

Figure 2-1 Image Theme and Other Themes Showing Boston Roadways

Text description of img_bost.gif follows.

Text description of the illustration img_bost.gif

Before you can define an image theme, you must follow these rules in organizing your image data:

To predefine an image theme, follow the guidelines in Section 2.3.4.1. To define a dynamic image theme in a map request, follow the guidelines for defining a JDBC theme, as explained in Section 2.3.2 and Section 3.2.7, but note the following additional considerations with dynamic image themes:

For any image theme definition, note the following considerations:

For an example of a map request specifying an image theme, including an explanation of how MapViewer processes the request, see Example 3-5 in Section 3.1.5.

2.3.4.1 Storing Image Theme Definitions in the Database

To permanently store the definition of an image theme, you must insert a row into the USER_SDO_THEMES view. Example 2-11 stores the definition of an image theme.

Example 2-11 Storing an Image Theme in the Database

INSERT INTO user_sdo_themes  VALUES (
   'IMAGE_LEVEL_2', 
   'Orthophotos at pyramid level 2', 
   'IMAGES',
   'IMAGE_MBR', 
   '<?xml version="1.0" standalone="yes"?>
    <styling_rules theme_type="image" image_column="image"
                   image_format="JPEG" image_resolution="2"
                   image_unit="M">
      <rule >
        <features style="C.RED"> plevel=2 </features>
      </rule>
    </styling_rules>' );

Example 2-11 creates an image theme named IMAGE_LEVEL_2. The base table (where all image data and associated MBRs are stored) is named IMAGES, and the MBRs for the images are stored in the column named IMAGE_MBR. In the STYLING_RULES column of the USER_SDO_THEMES view, an XML document with one <styling_rules> element is inserted.

The <styling_rules> element for an image theme has the following attributes:

2.4 Maps

A map can consist of a combination of elements and attributes, such as the following:

These elements and attributes, when specified in a map request, define the content and appearance of the generated map. Chapter 3 contains detailed information about the available elements and attributes for a map request.

A map can have a base map and a stack of themes rendered on top of each other in a window. A map has an associated coordinate system that all themes in the map must share. For example, if the map coordinate system is 8307 (for Longitude / Latitude (WGS 84), the most common system used for GPS devices), all themes in the map must have geometries defined using that coordinate system.

You can add themes to a map by specifying a base map name or by using the programming interface to add themes. The order in which the themes are added determines the order in which they are rendered, with the last specified theme on top, so be sure you know which themes you want in the background and foreground.

All base map names and definitions for a database user are stored in that user's USER_SDO_MAPS view, which is described in Section 2.5 and Section 2.5.1. The DEFINITION column in the USER_SDO_MAPS view contains an XML description of a base map.

Example 2-12 shows a base map definition.

Example 2-12 XML Definition of a Base Map

<?xml version="1.0" ?>
<map_definition>
<theme name="theme_us_states"    min_scale="10"  max_scale="0" />
<theme name="theme_us_parks"     min_scale="5"   max_scale="0" />
<theme name="theme_us_highways"  min_scale="5"   max_scale="0" />
<theme name="theme_us_streets"   min_scale="0.05" max_scale="0" />
</map_definition>

Each theme in a base map can be associated with a visible scale range within which it is displayed. In Example 2-12, the theme named theme_us_streets is not displayed unless the map request is for a map scale of 0.05 or less and greater than 0 (in this case, a scale showing a great deal of detail). If the min_scale and max_scale attributes are not specified, the theme is displayed whenever the base map is displayed. (For more information about map scale, see Section 2.4.1.)

The display order of themes in a base map is the same as their order in the base map definition. In Example 2-12, the theme_us_states theme is rendered first, then theme_us_parks, then theme_us_highways, and finally (if the map scale is within all specified ranges) theme_us_streets.

2.4.1 Map Size and Scale

Map size is the height of the map in units of the map data space. For example, if the map data is in WGS 84 geographic coordinates, the map center is (-120.5, 36.5), and the size is 2, then the height of the map is 2 decimal degrees, the lower Y (Latitude) value is 35.5 degrees, and the upper Y value is 37.5 decimal degrees.

Map scale is expressed as units in the user's data space that are represented by 1 inch on the screen or device. Map scale for MapViewer is actually the denominator value in a popular method of representing map scale as 1/n, where:

For example:

The min_scale and max_scale attributes in a <theme> element describe the visible scale range of a theme. These attributes control whether or not a theme is displayed, depending on the current map scale. The default scale value for min_scale is positive infinity, and the default value for max_scale is negative infinity (or in other words, by default display the theme for all map scales, if possible given the display characteristics).

A high min_scale value is associated with less map detail and a smaller scale in cartographic terms, while a high max_scale value is associated with greater map detail and a larger scale in cartographic terms. (Note that the MapViewer meaning of map scale is different from the popular meaning of cartographic map scale.) The min_scale value for a theme should be larger than the max_scale value. Example 2-12 in Section 2.4 includes min_scale and max_scale values.

To determine the current map scale for a map returned by MapViewer, first find the map size, namely the height (vertical span) of the map in terms of the coordinate system associated with the map data. For example, assume that a map with a height of 10 (miles, meters, decimal degrees, or whatever unit of measurement is associated with the data) is requested, and that the map is drawn on a device with a size of 500 by 350 pixels, where 350 is the height. MapViewer assumes a typical screen resolution of 72 dpi. Because 72 pixels equals 1 inch, the height of the returned map is 4.86 inches (350/72 = 4.86). In this example, the size of the map is 10, and therefore the map scale is approximately 2.057 (10/4.86 = 2.057).

2.4.2 Map Legend

A map legend is an inset illustration drawn on top of the map and describing what various colors, symbols, lines, patterns, and so on represent. You have flexibility in specifying the content and appearance of the legend. You can:

Example 2-13 is an excerpt from a request that includes a legend.

Example 2-13 Legend Included in Map Request

<?xml version="1.0" standalone="yes"?>
<map_request
             basemap="density_map"
             datasource = "mvdemo">
  <center size="1.5">
     ...
  </center>

  <legend bgstyle="fill:#ffffff;fill-opacity:128;stroke:#ff0000" 
          position="NORTH_WEST">
    <column>
      <entry text="Map Legend" is_title="true" />
      <entry style="M.STAR" text="center point" />
      <entry style="M.CITY HALL 3" text="cities" />
      <entry is_separator="true" />
      <entry style="C.ROSY BROWN STROKE" text="state boundary" />
      <entry style="L.PH" text="interstate highway" />
      <entry text="County population:" />
      <entry style="V.COUNTY_POP_DENSITY" tab="1" />
    </column>
  </legend>

  <themes>
     ...    
  </themes>
  
</map_request>  

Figure 2-2 shows a map with the legend specified in Example 2-13.

Figure 2-2 Map with Legend

Text description of legend.gif follows.

Text description of the illustration legend.gif

Notes on Example 2-13 and Figure 2-2:

For detailed information about adding a legend to a map request, see Section 3.2.10.

If you also specify a map title, note, or logo (or any combination), be sure that the legend and the other features have different positions. (Map titles, notes, and logos are explained in Section 1.5.5.) The default position for a legend is SOUTH_WEST.

2.4.3 Processing of Map Requests

A map specified in the XML map request includes a data source name, an optional base map name, and an optional array of theme descriptors for a set of predefined and dynamic themes. If a base map name is specified, the description of that base map (that is, the theme names, their display order, and their scale ranges) is determined by reading the DEFINITION column value associated with that base map in the ALL_SDO_MAPS view (described in Section 2.5.1). That is, MapViewer performs the following query from the user-specified data source:

SELECT DEFINITION FROM ALL_SDO_MAPS WHERE NAME=:basemap AND OWNER=:username;

2.5 MapViewer Metadata Views

The mapping metadata describing base maps, themes, and styles is stored in the global tables SDO_MAPS_TABLE, SDO_THEMES_TABLE, and SDO_STYLES_TABLE, which are owned by MDSYS. However, you should never directly update these tables. Each MapViewer user has the following views available in the schema associated with that user:

The USER_SDO_xxx views contain metadata information about mapping elements (styles, themes, base maps) owned by the user (schema), and the ALL_SDO_xxx views contain metadata information about mapping elements on which the user has SELECT permission.

The ALL_SDO_xxx views include an OWNER column that identifies the schema of the owner of the object. The USER_SDO_xxx views do not include an OWNER column.

All styles defined in the database can be referenced by any user to define that user's themes, markers with a text style, or advanced styles. However, themes and base maps are not shared among users; so, for example, you cannot reference another user's themes in a base map that you create.

The following rules apply for accessing the mapping metadata:

The MapViewer metadata views are defined in the following file:

$ORACLE_HOME/lbs/admin/mapdefinition.sql

The following sections describe each set of views.

2.5.1 xxx_SDO_MAPS Views

The USER_SDO_MAPS and ALL_SDO_MAPS views have the columns listed in Table 2-3.

Table 2-3  xxx_SDO_MAPS Views
Column Name Data Type Description

OWNER

VARCHAR2

Schema that owns the base map (ALL_SDO_MAPS only)

NAME

VARCHAR2

Unique name to be associated with the base map

DESCRIPTION

VARCHAR2

Optional descriptive text about the base map

DEFINITION

CLOB

XML definition of the list of themes and their scale value range information to be associated with the base map

2.5.2 xxx_SDO_THEMES Views

The USER_SDO_THEMES and ALL_SDO_THEMES views have the columns listed in Table 2-4.

Table 2-4  xxx_SDO_THEMES Views
Column Name Data Type Description

OWNER

VARCHAR2

Schema that owns the theme (ALL_SDO_THEMES only)

NAME

VARCHAR2

Unique name to be associated with the theme

DESCRIPTION

VARCHAR2

Optional descriptive text about the theme

BASE_TABLE

VARCHAR2

Table or view containing the spatial geometry column

GEOMETRY_COLUMN

VARCHAR2

Name of the spatial geometry column (of type MDSYS.SDO_GEOMETRY)

STYLING_RULES

CLOB

XML definition of the styling rules to be associated with the theme

2.5.3 xxx_SDO_STYLES Views

The USER_SDO_STYLES and ALL_SDO_STYLES views have the columns listed in Table 2-5.

Table 2-5  xxx_SDO_STYLES Views
Column Name Data Type Description

OWNER

VARCHAR2

Schema that owns the style (ALL_SDO_STYLES only)

NAME

VARCHAR2

Unique name to be associated with the style

TYPE

VARCHAR2

One of the following values: COLOR, MARKER, LINE, AREA, TEXT, or ADVANCED

DESCRIPTION

VARCHAR2

Optional descriptive text about the style

DEFINITION

CLOB

XML definition of the style

IMAGE

BLOB

Image content (for example, airport.gif) for marker or area styles that use image-based symbols (for markers) or fillers (for areas)

GEOMETRY

MDSYS.SDO_GEOMETRY

(Reserved for future use)


Go to previous page Go to next page
Oracle
Copyright © 2001, 2003 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index