Spatial Visualization - technical tips, best practices, and news from the product team

  • May 7, 2013

Intro to the V2 API

Jayant Sharma
Sr. Director, Product Mgmt

So what is the V2 API? Same as the V1 (oracle maps javascript) API but different :-)

The key differences are:

  •  Client side rendering of themes (or theme-based FOI) using SVG or html5 canvas. Themes are called vector layers in V2. FOI are called Features.

  • A map tile layer is not required in order to display a vector layer (theme). That is, a layer (such as county_population_density) can be displayed just by itself and have specified (fixed) zoom levels without any background tile layer. In other words you can have interactive, zoom-able, thematic maps.
  • A namespace (OM) and a different way of specifying parameters. (This is best explained by examples and will be done below)
  • Support for json files as a data source, aka data packs.

What then are the similarities? Well the same concepts (tile layers, themes, styles, styling rules), architecture, and content organization apply. They both depend on Oracle Spatial for spatial data management and analysis. And while one could define all styles and tile layer definitions dynamically, the ones defined via MapBuilder still work. The table below (from the user guide. Thanks Chuck) lists the correspondence between methods in V1 and V2.

V1 API Class V2 API Class



MVMapTileLayer, MVBingTileLayer, built-in tile layers

OM.layer.TileLayer, OM.layer.BingTileLayer, ElocationTileLayer, NokiaTileLayer, OSMTileLayer


Custom tile layers are not directly supported in the current release
of V2. However, you can use custom tile layers by extending OM.layer.TileLayer and supplying a getTileURL callback function.






OM.geometry and its subclasses


OM.event and its subclasses



Styles (MVStyleColor, MVXMLStyle, MVBucketStyle, MVBarChartStyle, and so on)

OM.style and its subclasses

Tools (MVToolbar, MVDistanceTool, MVCircleTool, and so on)

OM.tool and its subclasses

Decorations and controls (MVNavigationPanel, MVMapDecoration, MVScaleBar, and so on)

OM.control and its subclasses

 The V2 API has the following top-level classes and subpackages, all of which are in the namespace OM:

  • The Map class is the main class of the API.

  • The Feature class represents individual geo features (or FOIs as they were known in V1).

  • The MapContext class a top-level class encapsulating
    some essential contextual information, such as the current map center
    point and zoom level. It is typically passed into event listeners.

  • The control package contains all the map controls, such as navigation bar and overview map.

  • The event package contains all the map and layer event classes.

  • The filter package contains all the client-side filters
    (spatial or relational) for selecting, or subsetting, the displayed
    vector layer features.

  • The geometry package contains various geometry classes.

  • The layer package contains various tile and vector layer
    classes. The tile layer classes include access to a few online map
    services such as Oracle, Nokia, Bing, and OpenStreetMap. The vector
    layers are interactive feature layers and correspond to the MVThemeBasedFOI and MVFOI classes of V1.

  • The infowindow package contains the customizable information windows and their styles.

  • The style package contains styles applicable to vector
    data on the client side. It also includes visual effects such as
    animation, gradients, and drop shadows.

  • The tool package contains various map tools such as for distance measuring, red-lining, and geometry drawing.

  • The universe package contains built-in, or predefined, map universes.
    A map universe defines the bounding box and set of zoom level
    definitions for the map content. It is similar to a tile layer
    configuration in the V1 API.

  • The util package contains various utility classes.

  • The visualfilter package provides an interface for the various visual effects, such as gradients and drop shadows.

OM.Map is the main entry class for all map operations
inside the web browser. This and other classes provide interfaces for
adding application-specific logic, operations, and interactivity in web
mapping applications.

In the next post we'll look at a simple example of using the V2 API.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.