Professional Documents
Culture Documents
Agenda
q q q q q q q q q
Overview of Mapping Capability Oracle Spa6al Architecture Manage Map Data Implemen6ng Your First Map Dening Custom Background Maps Oracle Locator vs Oracle Spa6al Spa6al Interac6ons Spa6al Func6ons within Answers Spa6al Metadata Deployment
The ability to embed maps in to Oracle BI Dashboards is an exci6ng new development for OBIEE 11g Report developers have the power to build colourful and interac6ve maps within their BI Dashboards.no coding or technical know-how required!
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
Create an Analysis within Answers as you normally would Then just add a Map view to the Analysis 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 congured for display on a Map by the OBIEE administrator
Colour Fill
Bar Graph
Pie Graph
Bubble
Peak Indicators Limited
Variable Shape
Image
6
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
It is possible to interact with Maps just like you can with other any other OBIEE chart
OBIEE 11g does support download and print op6ons for Maps:
Powerpoint
10
11
Oracle
Database
Stores the deni6ons of spa6al objects (using special geometry data types) Locator database op6on for querying, ltering, 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 dene the content and structure of maps and their rendering rules
12
Congure MapViewer server Congure Map Tiles Congure data sources Clear geometry caches
13
14
Each
schema
on
the
database
has
a
set
of
system
views
to
contain
the
4
areas
of
metadata
used
by
MapBuilder/MapViewer:
15
16
q Spa3al Data-Structures
17
Spa3al
Data-Structures
q
A road map is a two-dimensional object that contains points, lines, and polygons that can represent ci6es, roads, and county boundaries
The
data
that
indicates
the
Earth
loca6on
(such
as
longitude
and
la6tude)
of
these
rendered
objects
is
the
spa6al
data
Other
types
of
spa6al
data
can
be
stored
on
the
Oracle
database:
So spa6al does not just mean maps! It can be chip-boards, aircral wings, bridges....
18
Spa3al
Data-Structures
q
The Oracle Database has a spa6al data-type called SDO_GEOMETRY to store the various Geometric Types:
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 );
20
With
any
spa6al
column,
the
rst
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:
VALUES ( 'cola_markets', 'geometry', SDO_DIM_ARRAY( SDO_DIM_ELEMENT('X', 0, 20, 0.005), SDO_DIM_ELEMENT('Y', 0, 20, 0.005) ), NULL );
-- 20X20 grid
21
A
Rectangle:
INSERT INTO cola_markets VALUES( 1, 'cola_a', 100, SDO_GEOMETRY( 2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), SDO_ORDINATE_ARRAY(1,1, 5,7)
-- two-dimensional polygon
-----
one rectangle (1003 = exterior) only 2 points needed to define rectangle (lower left and upper right) with Cartesian-coordinate data
) );
22
23
A
Circle:
INSERT INTO cola_markets VALUES( 4, 'cola_d', 400, SDO_GEOMETRY( 2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,4), SDO_ORDINATE_ARRAY(8,7, 10,9, 8,11) ) );
-- two-dimensional polygon
24
25
26
27
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
Here the whole geometry for the UK border is stored in a single record:
28
29
One method of rendering maps within OBIEE 11g is to have all your spa6al data stored in an Oracle Database 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
This
map
will
consist
of
many
dierent
sets
of
geometries
all
layered
on
top
of
each
other:
Country Boundaries Ocean Boundaries City Loca6ons Highways State Boundaries Lakes etc
30
NAVTEQ sample map data is available for download (with install instruc6ons) from OTN:
hSp://www.oracle.com/technology/solware/products/mapviewer/index.html
q q
Maps covering further detail can be purchased directly from NAVTEQ Digital map data is approx 300MB in size
31
32
An
SRID
(Spa6al
Reference
IDen6er)
is
an
integer
value
which
describes
the
type
of
coordinate
system
being
used
by
a
spa6al
engine
When
you
build
a
map,
you
need
to
state
the
SRID.
The
SRID
is
largely
dependent
on
the
map
provider
The
database
table
MDSYS.CS_SRS
contains
the
complete
list
of
dierent
coordinate
systems
There are over 4,500 dierent coordinate systems listed by 156 dierent organiza6ons Oracle has 996, which is more than anyone else!
The most common one used by Oracle is 8307 which refers to a specic Longitude/ La6tude coordinate system (Google Maps uses 3785)
33
34
The OBIEE 11g Administra6on screen contains a new op6on that allows you to congure your map data:
35
First
of
all,
you
dene
one
or
more
Layers
that
can
be
rendered
on
top
of
a
map.
Layers
can
be
either:
Points Polygons
In order to use maps with OBIEE, you must have at least one Layer
36
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 dened in MapBuilder which are stored in the table USER_SDO_THEMES
37
Once
the
Layer
is
imported,
you
can
edit
congure
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)
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
38
Once your Layers have been dened, you can import Background Maps and then congure which Layers can use them:
39
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 dened in MapViewer, and are stored in the database table USER_SDO_CACHED_MAPS
40
Once
the
Background
Maps
is
imported,
you
can
edit
congure
it
for
use
with
OBIEE:
Specify which Layers can use the map, and at which zoom levels Congure the order in which the Layers appear on top of each other on a map
This Background Map has 3 Layers, with OBIEE_CUSTOMERS displayed on top of the others
41
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 dened within MapBuilder and are stored in the database table USER_SDO_STYLES
42
43
44
45
There
are
several
reasons
why
you
may
wish
to
dene
custom
Background
Maps:
You wish to use a dierent 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
If
you
wish
to
use
further
custom
Background
Maps
with
OBIEE,
you
have
the
two
op6ons:
46
Use an external provider e.g. integrate with a Web Map Service (WMS) provider
Use MapBuilder to dene further internal Background Maps. The metadata is stored in the database
47
Note that map providers such as Google Maps are not yet supported 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
48
49
You
can
use
MapBuilder
to
dene
further
custom
Background
Maps
for
use
with
OBIEE.
The
rst
thing
you
do
is
dene
a
new
Base
Map
A
Base
Map
is
made
up
of
one
or
more
Themes:
You dene the order in which the Themes overlay on top of each other You dene 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!
50
In
our
example,
we
are
going
to
create
a
new
Base
Map
called
WORLD_MAP_OBIEE
This
will
be
similar
to
the
default
NAVTEQ
WORLD_MAP
but
with
a
signicantly
reduced
number
of
Themes
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
The
Base
Map
will
be
formed
of
just
two
Themes:
M_OCEANS_S01
M_ADMIN_AREA1_S01
51
You can create a new Base Map using the following op6on:
52
Specify the Themes you wish to use, star6ng with the boSom layer
53
Click Finish to complete the crea6on Go to the Preview tab and view your new Base Map!
54
Now our Base Map is complete, we need to deploy it to MapViewer by crea6ng a Map Tile Layer
55
Choose the SRID (typically 8307 for an Oracle Spa6al map) and the X/Y coordinate ranges
56
Next you have to dene 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 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
57
Under normal circumstances you can choose the default Tile Proper6es congura6on:
58
Thats it! Click Finish to save the metadata in the database where it can be accessed by MapViewer
59
You should be able to log onto MapViewer and see the new Map Tile Layer listed straight away:
60
61
It is possible to create Map Tile Layers in MapViewer from external Base Maps External Base Maps are maps which are sourced from somewhere other than your own internal Oracle database 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 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 specica6on was developed and rst published by the Open Geospa6al Consor6um in 1999
62
Within MapViewer, on the Manage Map Tile Layers screen choose the Create op6on Select External as the type of map source
63
You will now be prompted for a number of parameters 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 deni6on:
64
External
Background
Maps
Specify
Parameters
:
Map
URL
and
Java
Class
q
Specify
the
Map
service
URL
and
Java
Adapter
Class
/
Jar
le
These should be provided to you by the WMS provider Map Service URL: Adapter class: Jar le loca6on: hSp://osm.wheregroup.com/cgi-bin/mapserv mcsadapter.WMSAdapter [OBIEE_Home]/Oracle_BI1/bifounda6on/jee/ mapviewer.ear/web.war/WEB-INF/6leserver/mvadapter/ mvadapter.jar
You should be able to see this JAR le within your MapViewer deployment loca6on
65
Enable
the
Adapter
Proper6es
op6on
and
add
proper6es
as
required
by
your
WMS
provider:
66
Enter
the
coordinate
system
that
you
would
like
your
Map
Tile
Layer
to
use:
NOTE:
Your
WMS
provider
is
likely
to
use
a
dierent
SRID
to
Oracles
8307,
but
MapViewer
will
translate
the
WMS
providers
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!
67
Click the Submit buSon to nish the crea6on of your external Map Tile Layer Try previewing it!
68
You should be able to immediately test out the new Background Map on your OBIEE Dashboards:
69
70
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 ltering spa6al data General u6li6es e.g. valida6ng spa6al data
Locator should be sucient 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
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
71
Locator
vs
Spa3al
q
Locator and Spa6al func6ons/objects are created within the MDSYS schema on the Oracle database It is not immediately obvious which features are Locator (free) and which require a Spa6al license 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
As a general rule: If you are manipula6ng spa6al data in any way then you probably require a Spa6al license!
72
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
73
The
SDO_CONTAINS
locator
func6on
is
being
used
here
to
determine
which
countries
are
associated
with
a
set
of
longitude/la6tude
co- ordinates:
SELECT FROM WHERE AND f.geometry, d.country w_case_f f, w_country_d d f.country_wid = d.row_wid SDO_CONTAINS(d.country_geom,f.geometry) = 'TRUE'
74
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
75
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);
76
q Spa3al Interac3ons
77
Spa3al
Interac3ons
q
One of the key benets that comes with OBIEE 11gs mapping capability is the ability to interact with the maps just like they were standard Table/ Chart views
78
When you click on the map, an info window will appear displaying informa6on about the polygon/point you just clicked on
79
By default, you will get the same default Drill-Down interac6ons as you get with any other Table/ Chart 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
80
By clicking on the Business Group link we get a new map showing data by all the child Organiza6ons Note how the Table underneath the map has also changed to list data for all Organiza6ons
81
Now this 6me we shall instead click on Vision Nordics 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
82
And heres the result! We get a new map showing just the Organiza6ons for Vision Nordics NOTE:
83
Clicking on the map will ini6ate a Master-Detail event to change the data displayed in the Graph
84
It is also possible to set up Ac6on Links for your maps for naviga6on between dashboards/analyses:
85
86
The
Oracle
Spa6al
database
with
its
Locator/Spa6al
func6ons
provide
a
huge
array
of
spa6al
analysis
capability
It
would
be
good
to
be
able
to
use
it
from
Answers!
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!
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 specic distance from your chosen loca6on
87
A
func6on
obiee_distance
has
been
created
on
the
database
It
accepts
two
parameters:
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
It then uses the spa6al func6on SDO_DISTANCE to return the distance between the two loca6ons
The func6on returns the distance (in KM) between the two geometry coordinates
88
For example, we can call the obiee_distance func6on to show that the Department of Jus6ce is 5.76km from London
89
q Column Formulas
90
Column
Formulas
q
We are going to congure a Dashboard Page to allow the user to choose a city loca6on, the Analysis will then show the distance (in KM) between the users loca6on and each customer listed on the report
91
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
92
Then
open
up
your
Analysis
for
edi6ng
Add
a
new
column
called
Distance
from
your
loca6on
(KM)
Use
the
following
column
formula:
EVALUATE('obiee_distance(''@{PR_LOCATION}{LONDON}'',%1)' AS DOUBLE, "Customer"."Customer Name")
93
Changing
your
loca6on
using
the
Dashboard
Prompt
will
change
the
distances
between
you
and
the
customer!
94
q Column Filters
95
Column
Filters
q
Well now add a lter to the Analysis that will allow the user to return only customers that are within a chosen distance of their chosen loca6on:
96
First of all, add a new column to your Dashboard Prompt to allow the user to enter a number value (the distance in km) Congure the prompt to populate a Presenta6on Variable e.g. PR_DISTANCE
97
Within Answers, choose to lter on the column which calculates the distance between your chosen loca6on and the customer:
98
Congure the lter so that the distance value must be less than the presenta6on variable PR_DISTANCE (default 1000):
99
100
101
Each
schema
on
the
database
has
a
set
of
system
views
to
contain
the
4
areas
of
metadata
used
by
MapBuilder/MapViewer:
102
As
these
4
tables
are
System
Views
on
the
database,
you
cannot
export/ import
them
directly
To
migrate
the
metadata
in
these
4
tables,
you
have
to
run
a
4
step
process:
1. 2. 3. 4.
Copy the metadata into 4 Temporary Tables Export the 4 Temporary Tables Import the 4 Temporary Tables into your target environment Insert the metadata from the Temporary Tables into the System Views
103
3.
3.
4.
104
q Ques3ons?