oracle map viewer
TRANSCRIPT
© Peak Indicators Limited
Oracle Business Intelligence 11g Spa3al Integra3on
Antony Heljula Technical Architect
© Peak Indicators Limited 2
Agenda
q Overview of Mapping Capability q Oracle Spa6al Architecture q Manage Map Data q Implemen6ng Your First Map q Defining Custom Background Maps q Oracle Locator vs Oracle Spa6al q Spa6al Interac6ons q Spa6al Func6ons within Answers q Spa6al Metadata Deployment
© Peak Indicators Limited 3
Overview of Mapping Capability
q The ability to embed maps in to Oracle BI Dashboards is an exci6ng new development for OBIEE 11g
q Report developers have the power to build colourful and interac6ve maps within their BI Dashboards….no coding or technical know-‐how required!
© Peak Indicators Limited 4
Overview of Mapping Capability
q Oracle MapViewer is a java applica6on used to render maps on behalf of other applica6ons Ø Oracle MapViewer is installed as part of the standard OBIEE 11g installa6on Ø It is deployed onto WebLogic. Default URL hSp://[biserver]:9704/mapviewer Ø No extra licenses required for OBIEE customers to render maps
Oracle MapViewer
© Peak Indicators Limited 5
Overview of Mapping Capability
q Create an Analysis within Answers as you normally would
q Then just add a “Map” view to the Analysis
q You just need to make sure at least one of the columns can be rendered on a map! Ø In this example, each “Organiza6on
Name” corresponds to a geographical country and this has been configured for display on a Map by the OBIEE administrator
Crea3ng Maps is Easy!
© Peak Indicators Limited 6
Overview of Mapping Capability Types of Layer
Colour Fill Bar Graph Pie Graph
Bubble Variable Shape Image
© Peak Indicators Limited 7
Overview of Mapping Capability
q The user can choose which layers to display on the map
Enabling/Disabling Layers
Turn off a layer simply by
unchecking the corresponding check-‐box
© Peak Indicators Limited 8
Overview of Mapping Capability
q “Custom Point Layers” are where the co-‐ordinates are taken from the Analysis itself Ø Mapping coordinates can come from any type of data source! Ø Longitude/La6tude co-‐ordinates can be provided in a single column or separate columns Ø Supported with Bubble, Variable Shape and Image layers
Custom Point Layers
© Peak Indicators Limited 9
Overview of Mapping Capability
q It is possible to interact with Maps just like you can with other any other OBIEE chart Ø Just click on the area that is of interest
Interac3on
Ac6on Link to open up a different analysis Drill-‐Down to a lower
hierarchy level
© Peak Indicators Limited 10
Overview of Mapping Capability
q OBIEE 11g does support download and print op6ons for Maps:
Prin3ng and Downloading
Powerpoint PDF
© Peak Indicators Limited 11
q Oracle Spa3al Architecture
© Peak Indicators Limited 12
Oracle Spa3al Architecture
q An Oracle Spa6al Architecture will typically consist of the following components: Ø Oracle Database
§ Stores the defini6ons of spa6al objects (using special geometry data types) § “Locator” database op6on for querying, filtering, joining spa6al data § “Spa6al” database op6on for manipula6ng and aggrega6ng spa6al data
Ø Oracle MapViewer § A J2EE applica6on used for rendering interac6ve map images and features-‐of-‐
interest (FOI) § Invoked via a series of XML, Java, PL/SQL and Javascript APIs § Provides a layer of caching
Ø Oracle MapBuilder § The development tool for MapViewer § A graphical Map builder tool that enables you to define the content and structure
of maps and their rendering rules
© Peak Indicators Limited 13
Oracle Spa3al Architecture
q The Management screens allow you to perform administra6ve tasks such as : Ø Configure MapViewer server Ø Configure Map Tiles Ø Configure data sources Ø Clear geometry caches
MapViewer
© Peak Indicators Limited 14
Oracle Spa3al Architecture MapBuilder
© Peak Indicators Limited 15
Oracle Spa3al Architecture
q Each schema on the database has a set of system views to contain the 4 areas of metadata used by MapBuilder/MapViewer:
Ø USER_SDO_STYLES Ø USER_SDO_THEMES Ø USER_SDO_MAPS Ø USER_SDO_CACHED_MAPS
Metadata
© Peak Indicators Limited 16
Oracle Spa3al Architecture with OBIEE Base Map + Layer
© Peak Indicators Limited 17
q Spa3al Data-‐Structures
© Peak Indicators Limited 18
Spa3al Data-‐Structures
q A common example of spa6al data can be seen in a road map Ø A road map is a two-‐dimensional object that contains points, lines, and
polygons that can represent ci6es, roads, and county boundaries
q The data that indicates the Earth loca6on (such as longitude and la6tude) of these rendered objects is the “spa6al data”
q Other types of spa6al data can be stored on the Oracle database: Ø Computer-‐aided design (CAD) Ø Computer-‐aided manufacturing (CAM)
q So “spa6al” does not just mean maps! It can be chip-‐boards, aircral wings, bridges....
© Peak Indicators Limited 19
Spa3al Data-‐Structures
q The Oracle Database has a spa6al data-‐type called “SDO_GEOMETRY” to store the various “Geometric Types”:
q NOTE: The Oracle Database can now also handle 3D objects
© Peak Indicators Limited 20
Spa3al Data-‐Structures
q Consider the following table which has contains an SDO_GEOMETRY column called GEOMETRY:
CREATE TABLE cola_markets
(
mkt_id NUMBER PRIMARY KEY,
name VARCHAR2(32),
sales NUMBER, geometry SDO_GEOMETRY
);
q We can then insert some records.....
Example
© Peak Indicators Limited 21
Spa3al Data-‐Structures
q With any spa6al column, the first thing we need to do is insert a record into the “USER_SDO_GEOM_METADATA” to tell the database what type of spa6al data is stored in the column. In our example: Ø A 20 x 20 grid Ø Tolerance of 0.005 (maximum precision)
INSERT INTO user_sdo_geom_metadata (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES ( 'cola_markets', 'geometry', SDO_DIM_ARRAY( -- 20X20 grid SDO_DIM_ELEMENT('X', 0, 20, 0.005), SDO_DIM_ELEMENT('Y', 0, 20, 0.005) ), NULL );
Example: Define GEOM Metadata
© Peak Indicators Limited 22
Spa3al Data-‐Structures
q A Rectangle:
INSERT INTO cola_markets VALUES( 1, 'cola_a', 100, SDO_GEOMETRY( 2003, -- two-dimensional polygon NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), -- one rectangle (1003 = exterior) SDO_ORDINATE_ARRAY(1,1, 5,7) -- only 2 points needed to define -- rectangle (lower left and upper right) -- with Cartesian-coordinate data
) );
Example: Rectangle
© Peak Indicators Limited 23
Spa3al Data-‐Structures
q 2 Simple Polygons, each with 5 points:
INSERT INTO cola_markets VALUES( 2, 'cola_b', 200, SDO_GEOMETRY( 2003, -- two-dimensional polygon NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,1), -- one polygon (exterior polygon ring) SDO_ORDINATE_ARRAY(5,1, 8,1, 8,6, 5,7, 5,1) ) ); INSERT INTO cola_markets VALUES( 3, 'cola_c', 300, SDO_GEOMETRY( 2003, -- two-dimensional polygon NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,1), -- one polygon (exterior polygon ring) SDO_ORDINATE_ARRAY(3,3, 6,3, 6,5, 4,5, 3,3) ) );
Example: 2 Simple Polygons
© Peak Indicators Limited 24
Spa3al Data-‐Structures
q A Circle:
INSERT INTO cola_markets VALUES( 4, 'cola_d', 400, SDO_GEOMETRY(
2003, -- two-dimensional polygon NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,4), -- one circle SDO_ORDINATE_ARRAY(8,7, 10,9, 8,11) -- 3 points needed )
);
Example: Circle
© Peak Indicators Limited 25
Spa3al Data-‐Structures
q Then finally we need to create a “Spa6al Index” on the SDO_GEOMETRY column:
CREATE INDEX cola_spatial_idx
ON cola_markets(geometry)
INDEXTYPE IS MDSYS.SPATIAL_INDEX;
Example: Spa3al Index
© Peak Indicators Limited 26
Spa3al Data-‐Structures Example: The Result
© Peak Indicators Limited 27
Spa3al Data-‐Structures
q MapViewer isn’t just for displaying road maps!
Example: The Result in OBIEE!
© Peak Indicators Limited 28
Spa3al Data-‐Structures
q A Country is simply a more complex polygon with many coordinates, and will be based on “Geode6c Coordinates” i.e. Longitude and La6tude Ø Longitude coordinates range from -‐180 to 180 Ø La6tude coordinates range from -‐90 to 90 Ø NOTE: the previous example which was based on “Cartesian Coordinates”
q Here the whole geometry for the UK border is stored in a single record:
A Country?!
© Peak Indicators Limited 29
q NAVTEQ Digial Maps
© Peak Indicators Limited 30
NAVTEQ Digital Maps
q One method of rendering maps within OBIEE 11g is to have all your “spa6al” data stored in an Oracle Database
q Spa6al data is stored in the Oracle Database using a special “spa6al” data type called SDO_GEOMETRY Ø As an example, If you want to render Country boundaries you will have a table that
stores the “geometries” for each Country q This map will consist of many different sets of “geometries” all layered on top
of each other: Ø Country Boundaries Ø Ocean Boundaries Ø City Loca6ons Ø Highways Ø State Boundaries Ø Lakes Ø etc
© Peak Indicators Limited 31
Maps NAVTEQ Sample Maps
q NAVTEQ sample map data is available for download (with install instruc6ons) from OTN:
Ø hSp://www.oracle.com/technology/solware/products/mapviewer/index.html
q Data provided goes down to “postcode” level in 3 loca6ons:
Ø London Ø San Francisco Ø Sydney
q Maps covering further detail can be purchased directly from NAVTEQ
q Digital map data is approx 300MB in size
© Peak Indicators Limited 32
q Spa3al Reference Iden3fier (SRID)
© Peak Indicators Limited 33
Spa3al Reference Iden3fier (SRID)
q An SRID (Spa6al Reference IDen6fier) is an integer value which describes the type of coordinate system being used by a spa6al engine
q When you build a map, you need to state the SRID. The SRID is largely dependent on the map provider
q The database table MDSYS.CS_SRS contains the complete list of different coordinate systems Ø There are over 4,500 different coordinate systems listed by 156 different organiza6ons Ø Oracle has 996, which is more than anyone else!
q The most common one used by Oracle is 8307 which refers to a specific Longitude/La6tude coordinate system (Google Maps uses 3785)
© Peak Indicators Limited 34
q Manage Map Data
© Peak Indicators Limited 35
Manage Map Data
q The OBIEE 11g “Administra6on” screen contains a new op6on that allows you to configure your map data: Ø Manage Map Data
© Peak Indicators Limited 36
Manage Map Data
q First of all, you define one or more “Layers” that can be rendered on top of a map. Layers can be either: Ø Points Ø Polygons
q In order to use maps with OBIEE, you must have at least one Layer
Layers
Import / Delete / Edit Layer op6ons
© Peak Indicators Limited 37
Manage Map Data
q When you choose to import a new Layer, OBIEE will obtain the Layers that exist within the data source you choose Ø The Layers listed correspond to the “Themes” you defined in MapBuilder
which are stored in the table USER_SDO_THEMES
Impor3ng Layers
© Peak Indicators Limited 38
Manage Map Data
q Once the Layer is imported, you can edit configure it for use with OBIEE: Ø Specify Geometry Type (Either Point or Polygon) Ø Specify which Subject Area columns can be used for this layer (i.e. which
columns can be used to join to the spa6al data)
Edit Layer
In this example, the Layer is keyed on “ORGANIZATION”.
This means we can
link it to the “Organiza6on Name”
column in three Subject Areas:
Sales Forecast Sales Orders
Service Incidents
© Peak Indicators Limited 39
Manage Map Data
q Once your Layers have been defined, you can import Background Maps and then configure which Layers can use them:
Background Maps
Import / Delete / Edit Background Maps
© Peak Indicators Limited 40
Manage Map Data
q When you choose to import a new Background Map, OBIEE will obtain the Map Tile Layers that exist within the data source you choose Ø The maps listed correspond to the same “Map Tiles” which are defined in
MapViewer, and are stored in the database table USER_SDO_CACHED_MAPS
Impor3ng Background Maps
© Peak Indicators Limited 41
Manage Map Data
q Once the Background Maps is imported, you can edit configure it for use with OBIEE: Ø Specify which Layers can use the map, and at which zoom levels Ø Configure the order in which the Layers appear on top of each other on a map
Edit Background Maps
This Background Map has 3 Layers, with OBIEE_CUSTOMERS displayed
on top of the others
© Peak Indicators Limited 42
Manage Map Data
q You can import your own custom Images for use on your maps Ø When you choose to import an image, the images listed correspond to the
images defined within MapBuilder and are stored in the database table USER_SDO_STYLES
Images
© Peak Indicators Limited 43
q Implemen3ng Your First Background Map
© Peak Indicators Limited 44
Implemen3ng Your First Map Demonstra3on
© Peak Indicators Limited 45
q Defining Custom Background Maps
© Peak Indicators Limited 46
Defining Custom Background Maps
q There are several reasons why you may wish to define custom Background Maps: Ø You wish to use a different provider other than NAVTEQ Ø Your company may already have its own map data Ø You need to customise the exis6ng NAVTEQ maps e.g. reduce the number of
Themes to improve performance or reduce “cluSer” Ø You prefer to use an “external” map provider on the internet, rather than
having your maps stored in the underlying Oracle database
q If you wish to use further custom Background Maps with OBIEE, you have the two op6ons: Ø Internal Maps (using MapBuilder) Ø External Maps (using a Web Map Service provider)
© Peak Indicators Limited 47
Defining Custom Background Maps
Use MapBuilder to define further “internal” Background Maps. The metadata is stored in the database
Use an “external” provider e.g. integrate with a Web Map Service
(WMS) provider
© Peak Indicators Limited 48
Defining Custom Background Maps
q Note that map providers such as “Google Maps” are not yet supported
q MapViewer does actually have the capability to integrate with Google Maps and other such providers, but at the moment OBIEE 11g only supports providers who deliver their maps via Web Map Services
Note
© Peak Indicators Limited 49
q Internal Background Maps
© Peak Indicators Limited 50
Internal Background Maps
q You can use MapBuilder to define further custom Background Maps for use with OBIEE. The first thing you do is define a new “Base Map”
q A “Base Map” is made up of one or more “Themes”: Ø You define the order in which the Themes overlay on top of each other Ø You define the scale ranges to state when the Themes should appear (if you
are zoomed out then you might want to hide roads, ci6es etc)
The default WORLD_MAP provided by NAVTEQ is made up
from over 300 Themes!
© Peak Indicators Limited 51
Internal Background Maps
q In our example, we are going to create a new Base Map called WORLD_MAP_OBIEE
q This will be similar to the default NAVTEQ “WORLD_MAP” but with a significantly reduced number of Themes
q We will use this new Base Map later on in the training when we report at Country and Region level, where we are not interested in seeing roads, ci6es, etc
q The Base Map will be formed of just two Themes:
Example
M_ADMIN_AREA1_S01 M_OCEANS_S01
© Peak Indicators Limited 52
Internal Background Maps
q You can create a new Base Map using the following op6on: Ø Base Maps > Create Base Map
Create Base Map
© Peak Indicators Limited 53
Internal Background Maps
q Specify the Themes you wish to use, star6ng with the “boSom” layer
Choose Themes
© Peak Indicators Limited 54
Internal Background Maps
q Click “Finish” to complete the crea6on q Go to the “Preview” tab and view your new Base Map!
Preview
© Peak Indicators Limited 55
Internal Background Maps
q Now our Base Map is complete, we need to deploy it to MapViewer by crea6ng a “Map Tile Layer”
Create Map Tile Layer
© Peak Indicators Limited 56
Internal Background Maps
q Choose the SRID (typically 8307 for an Oracle Spa6al map) and the X/Y coordinate ranges Ø Click “Update from Map” to auto-‐populate these entries
Tile Layer Bounds
© Peak Indicators Limited 57
Internal Background Maps
q Next you have to define your zoom levels – the easiest way to do this is the zoom in/out on the map shown at the top and click the “From Map” buSon when you are at the appropriate Minimum/Maximum zoom level
q You can then set the “# Zoom Levels” and click “Generate” to generate all the levels of zoom you wish to have in between the Minimum/Maximum scales
Zoom Levels
© Peak Indicators Limited 58
Internal Background Maps
q Under normal circumstances you can choose the default Tile Proper6es configura6on:
q Specify a default background colour if you wish to have one:
Tile Proper3es
© Peak Indicators Limited 59
Internal Background Maps
q That’s it! Click “Finish” to save the metadata in the database where it can be accessed by MapViewer
Tile Layer Complete
© Peak Indicators Limited 60
Internal Background Maps
q You should be able to log onto MapViewer and see the new Map Tile Layer listed straight away:
MapViewer
© Peak Indicators Limited 61
q External Background Maps
© Peak Indicators Limited 62
External Background Maps
q It is possible to create Map Tile Layers in MapViewer from “external” Base Maps
q External Base Maps are maps which are sourced from somewhere other than your own internal Oracle database
q We shall show an example where we will create a new Map Tile Layer within MapViewer that is sourced from the “OpenStreetMap” Web Map Services (WMS) provider
q Wikipedia: Ø A Web Map Service (WMS) is a standard protocol for serving georeferenced
map images over the Internet that are generated by a map server using data from a GIS database.[2] The specifica6on was developed and first published by the Open Geospa6al Consor6um in 1999
© Peak Indicators Limited 63
External Background Maps
q Within MapViewer, on the “Manage Map Tile Layers” screen choose the “Create” op6on
q Select “External” as the type of map source
Create Map Tile Layer
© Peak Indicators Limited 64
External Background Maps
q You will now be prompted for a number of parameters
q First of all, specify the name of your new Map Tile Layer and the data source in which you will store the Map Tile Layer defini6on:
Specify Parameters : Name/Data Source
© Peak Indicators Limited 65
External Background Maps
q Specify the Map service URL and Java Adapter Class / Jar file Ø These should be provided to you by the WMS provider
Ø Map Service URL: hSp://osm.wheregroup.com/cgi-‐bin/mapserv Ø Adapter class: mcsadapter.WMSAdapter Ø Jar file loca6on:
Specify Parameters : Map URL and Java Class
[OBIEE_Home]/Oracle_BI1/bifounda6on/jee/ mapviewer.ear/web.war/WEB-‐INF/6leserver/mvadapter/ mvadapter.jar
You should be able to see this JAR file within
your MapViewer deployment loca6on
© Peak Indicators Limited 66
External Background Maps
q Enable the “Adapter Proper6es” op6on and add proper6es as required by your WMS provider: Ø service: WMS Ø srs: EPSG:4326 Ø format: image/png Ø map: /data/umn/osm/osm_basic.map Ø layers: OSM_Basic
Specify Parameters : Adapter Proper3es
Our WMS provider has uses SRID coordinate
system 4326
© Peak Indicators Limited 67
External Background Maps
q Enter the coordinate system that you would like your Map Tile Layer to use: NOTE: Your WMS provider is likely to use a different SRID to Oracle’s 8307, but
MapViewer will translate the WMS provider’s map data into the coordinate system you provide here. So if you use 8307 elsewhere in the system then you need to specify that here. Transla6ng the map data into 8307 will degrade performance, the only alterna6ve is to translate all your spa6al data to use the same coordinate system as your provider!
Specify Parameters : SRID
© Peak Indicators Limited 68
External Background Maps
q Click the “Submit” buSon to finish the crea6on of your external Map Tile Layer q Try previewing it!
Submit
© Peak Indicators Limited 69
External Background Maps
q You should be able to immediately test out the new Background Map on your OBIEE Dashboards:
Test!
© Peak Indicators Limited 70
q Oracle Locator vs Oracle Spa3al
© Peak Indicators Limited 71
Locator vs Spa3al
q Oracle Locator Ø Locator is a cut-‐down version of Oracle Spa6al and is provided free with the
database Standard and Enterprise Edi6ons Ø It provides as set of spa6al capabili6es for applica6on developers:
§ Spa6al indexing capabili6es § Func6ons for joining and filtering spa6al data § General u6li6es e.g. valida6ng spa6al data
Ø Locator should be sufficient for most of our BI implementa6ons unless, for example, the digital map data being used at the customer site needs to manipulated or aggregated in some way
q Oracle Spa3al Ø Spa6al is a licensed database op6on and is only available with Enterprise Edi6ons Ø It provides the Locator func6onality plus all geometry func6ons for spa6al
aggregate, spa6al analysis and mining func6ons, linear referencing system support and geo-‐coding
© Peak Indicators Limited 72
Locator vs Spa3al
q Locator and Spa6al func6ons/objects are created within the “MDSYS” schema on the Oracle database
q It is not immediately obvious which features are Locator (free) and which require a Spa6al license
q It is important therefore to refer to the following document which outlines the Locator/Spa6al features: Ø hSp://download.oracle.com/docs/cd/B28359_01/appdev.111/b28400/sdo_locator.htm#i632018
q As a general rule: If you are manipula6ng spa6al data in any way then you probably require a Spa6al license!
© Peak Indicators Limited 73
U3lising Oracle Locator
q Oracle Locator provides many func6ons that can help in a situa6on like this – see the documenta6on for more details Ø hSp://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_operat.htm#i76448
Oracle Locator Func3ons
© Peak Indicators Limited 74
U3lising Oracle Locator
q The SDO_CONTAINS “locator” func6on is being used here to determine which countries are associated with a set of longitude/la6tude co-‐ordinates: SELECT f.geometry, d.country FROM w_case_f f, w_country_d d
WHERE f.country_wid = d.row_wid
AND SDO_CONTAINS(d.country_geom,f.geometry) = 'TRUE'
Locator Example
© Peak Indicators Limited 75
U3lising Oracle Spa3al
q Oracle Spa6al provides a range of “spa6al aggregate” func6ons that can help in a situa6on like this – see the documenta6on for more details Ø hSp://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_aggr.htm#g998149
REMEMBER! You need a license for Oracle Spa6al to use any of these func6ons
Oracle Spa3al Func3ons
© Peak Indicators Limited 76
U3lising Oracle Spa3al
q The SDO_AGGR_UNION Spa6al aggregate func6on is being used here to “aggregate” all the Country geometries together to form larger Regions:
UPDATE w_region_d d SET region_geom =
(SELECT SDO_AGGR_UNION(SDOAGGRTYPE(country_geom, 0.0000005)) FROM w_country_d WHERE region = d.region);
Spa3al Example
© Peak Indicators Limited 77
q Spa3al Interac3ons
© Peak Indicators Limited 78
Spa3al Interac3ons
q One of the key benefits that comes with OBIEE 11g’s mapping capability is the ability to interact with the maps just like they were standard Table/Chart views
© Peak Indicators Limited 79
Spa3al Interac3ons
q When you click on the map, an info window will appear displaying informa6on about the polygon/point you just clicked on Ø you can configure this info window to display extra columns
Info Window
© Peak Indicators Limited 80
Spa3al Interac3ons
q By default, you will get the same default “Drill-‐Down” interac6ons as you get with any other Table/Chart
q If you click on “Business Group” then you will drill-‐down just as if you clicked on the “Business Group” column heading on the table underneath the map Ø You should see all Organiza6ons
being returned
Drill-‐Downs : Heading
© Peak Indicators Limited 81
Spa3al Interac3ons
q By clicking on the “Business Group” link we get a new map showing data by all the child “Organiza6ons”
q Note how the Table underneath the map has also changed to list data for all Organiza6ons
Drill-‐Downs : Heading
© Peak Indicators Limited 82
Spa3al Interac3ons
q Now this 6me we shall instead click on “Vision Nordics”
q We should drill-‐down just as if had clicked on the “Vision Nordics” value in the table underneath the map Ø You should see all Organiza6ons
being returned for Vision Nordics
Drill-‐Downs : Value
© Peak Indicators Limited 83
Spa3al Interac3ons
q And here’s the result! We get a new map showing just the “Organiza6ons” for “Vision Nordics”
q NOTE: Ø The map zoomed in automa6cally!
Drill-‐Downs : Value
© Peak Indicators Limited 84
Spa3al Interac3ons
q Master-‐Detail linking works even from maps as well!
Master-‐Detail Linking
Clicking on the map will ini6ate a Master-‐Detail event to change the data displayed in the Graph
© Peak Indicators Limited 85
Spa3al Interac3ons
q It is also possible to set up Ac6on Links for your maps for naviga6on between dashboards/analyses:
Ac3on Links
© Peak Indicators Limited 86
q Spa3al Func3ons within Answers
© Peak Indicators Limited 87
Spa3al Func3ons within Answers
q The Oracle Spa6al database with its Locator/Spa6al func6ons provide a huge array of spa6al analysis capability
q It would be good to be able to use it from Answers!
q OBIEE does not have any built-‐in spa6al func6ons, but using the EVALUATE func6ons we are able to call database spa6al func6ons directly from within Answers!
q We will be looking at two scenarios: Ø Calcula6ng the distance between your chosen loca6on and the customers Ø Retrieving data only where the customer is within a specific distance from
your chosen loca6on
© Peak Indicators Limited 88
Spa3al Func3ons within Answers
q A func6on “obiee_distance” has been created on the database
q It accepts two parameters: Ø A city loca6on Ø A customer name
q It then uses the spa6al func6on SDO_DISTANCE to return the distance between the two loca6ons
Example Database Func3on
The long/lat of the city loca6on is retrieved from the NAVTEQ
data
The long/lat of the customer loca6on is retrieved from our
data warehouse
The func6on returns the distance (in KM) between the two geometry coordinates
© Peak Indicators Limited 89
Spa3al Func3ons within Answers
q For example, we can call the “obiee_distance” func6on to show that the “Department of Jus6ce” is 5.76km from London
Example Database Func3on
© Peak Indicators Limited 90
q Column Formulas
© Peak Indicators Limited 91
Column Formulas
q We are going to configure a Dashboard Page to allow the user to choose a city loca6on, the Analysis will then show the distance (in KM) between the user’s loca6on and each customer listed on the report Ø To work out the distance, we will execute our db func6on “obiee_distance”
© Peak Indicators Limited 92
Column Formulas
q First of all, create a Dashboard Prompt to list all the City Loca6ons Ø You can use a new “Variable Prompt” to specify a custom list of loca6ons
q Configure the prompt to populate a Presenta6on Variable e.g. PR_LOCATION
Create Dashboard Prompt
© Peak Indicators Limited 93
Column Formulas
q Then open up your Analysis for edi6ng q Add a new column called “Distance from your loca6on (KM)” q Use the following column formula:
EVALUATE('obiee_distance(''@{PR_LOCATION}{LONDON}'',%1)' AS DOUBLE, "Customer"."Customer Name")
Configure Analysis
© Peak Indicators Limited 94
Column Formulas
q Changing your loca6on using the Dashboard Prompt will change the distances between you and the customer!
Preview Results
© Peak Indicators Limited 95
q Column Filters
© Peak Indicators Limited 96
Column Filters
q We’ll now add a filter to the Analysis that will allow the user to return only customers that are within a chosen distance of their chosen loca6on:
© Peak Indicators Limited 97
Column Filters
q First of all, add a new column to your Dashboard Prompt to allow the user to enter a number value (the distance in km)
q Configure the prompt to populate a Presenta6on Variable e.g. PR_DISTANCE
Create Dashboard Prompt
© Peak Indicators Limited 98
Column Filters
q Within Answers, choose to filter on the column which calculates the distance between your chosen loca6on and the customer:
Add Filter to Analysis
© Peak Indicators Limited 99
Column Filters
q Configure the filter so that the distance value must be “less than” the presenta6on variable “PR_DISTANCE” (default 1000):
Configure Filter
© Peak Indicators Limited 100
Column Filters
q Return to the Dashboard Page and test your new filter!
Test Analysis
© Peak Indicators Limited 101
q Spa3al Metadata Deployment
© Peak Indicators Limited 102
Custom Map Metadata
q Each schema on the database has a set of system views to contain the 4 areas of metadata used by MapBuilder/MapViewer:
Ø USER_SDO_STYLES Ø USER_SDO_THEMES Ø USER_SDO_MAPS Ø USER_SDO_CACHED_MAPS
© Peak Indicators Limited 103
Custom Map Metadata
q As these 4 tables are “System” Views on the database, you cannot export/import them directly
q To migrate the metadata in these 4 tables, you have to run a 4 step process: 1. Copy the metadata into 4 Temporary Tables 2. Export the 4 Temporary Tables 3. Import the 4 Temporary Tables into your target environment 4. Insert the metadata from the Temporary Tables into the System Views
© Peak Indicators Limited 104
Custom Map Metadata
1. Crea6ng 4 Temporary Tables on “dev”:
CREATE TABLE temp_sdo_cached_maps AS SELECT * FROM USER_SDO_CACHED_MAPS; CREATE TABLE temp_sdo_maps AS SELECT * FROM USER_SDO_MAPS; CREATE TABLE temp_sdo_styles AS SELECT * FROM USER_SDO_STYLES; CREATE TABLE temp_sdo_themes AS SELECT * FROM USER_SDO_THEMES;
3. Export from “dev”:
exp appsdw/appsdw@dev file=appsdw.dmp tables=temp_cached_maps,temp_maps,temp_styles,temp_themes
3. Import into “prod”:
imp appsdw/appsdw@prod file=appsdw.dmp
4. Inser6ng the Metadata into your “prod” System Views: INSERT INTO USER_SDO_CACHED_MAPS SELECT * FROM temp_sdo_cached_maps; INSERT INTO USER_SDO_MAPS SELECT * FROM temp_sdo_maps; INSERT INTO USER_SDO_STYLES SELECT * FROM temp_sdo_styles; INSERT INTO USER_SDO_THEMES SELECT * FROM temp_sdo_themes; COMMIT;
Examples
© Peak Indicators Limited
q Ques3ons?
© Peak Indicators Limited
Helping Your Business Intelligence Journey