MapViewer - Installation of the demo files

> MAPViewer

1 - About

This article talk about the installation of the spatial demo set that you need to run the Oracle Maps Tutorial (online demos) listed at the bottom of the MapViewer home page.

After a standard installation of OBIEE (10g or 11g), you can find them on this URL :

Advertising

3 - Installation Process

3.1 - Download the zip file

Download the mvdemo.zip file. This is a downloadable zip file containing a complete MapViewer demo including sample data and instructions. (Zip 3.9MB)

If you don't have it in the bundled archive, you can find it on the page Oracle Fusion Middleware MapViewer Training. An the end of this page, you have this link MapViewer Demo.

Unzip it in a temp directory (Ex. : C:\temp)

The readme.txt from the zip contain also all the instructions to load properly the data.

3.2 - Create the user

You can add the data set in any account, you want. For the rest of the article, we will use a special mvdemo account.

In SqlPlus - SqlPlus Command :

SQL> CONNECT / AS sysdba;
Connected.
SQL> grant CONNECT, resource, CREATE VIEW TO mvdemo identified BY mvdemo;
Grant succeeded.

3.3 - Import the data set

In the command Prompt (assume you have unzipped the demo.zip file in the directory C:\TEMP\mvdemo) :

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
 
C:\Documents and Settings\Nicolas>cd C:\TEMP\mvdemo
 
C:\TEMP\mvdemo>set NLS_LANG=American_America.WE8ISO8859P1
 
C:\TEMP\mvdemo>imp mvdemo/mvdemo@ORCL file=mvdemo.dmp full=y ignore=y
 
Import: Release 10.2.0.4.0 - Production on Fri Nov 21 15:18:34 2008
 
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
 
 
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
Export file created by EXPORT:V09.00.01 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. importing MVDEMO's objects into MVDEMO
. importing MVDEMO's objects into MVDEMO
. . importing table                       "CITIES"        195 rows imported
. . importing table                     "COUNTIES"       3230 rows imported
. . importing table                    "EMPLOYEES"         14 rows imported
. . importing table                  "INTERSTATES"        239 rows imported
. . importing table                         "MAPS"          4 rows imported
. . importing table                       "STATES"         56 rows imported
. . importing table                       "STYLES"        285 rows imported
. . importing table                  "TERRITORIES"          9 rows imported
. . importing table                "TERR_COUNTIES"       3230 rows imported
. . importing table                       "THEMES"         10 rows imported
Import terminated successfully without warnings.
 
C:\TEMP\mvdemo>
Advertising

3.4 - Cache Map Metadata

If your database has never run the mcsdefinition.sql script before, you will need to run it as DBA role. To verify if this script has been run, you can log into the database (as any user), and execute the following query:

SQL>CONNECT SYS/SysPassword@ORCL AS sysdba;
Connected.
SQL>SELECT name FROM user_sdo_cached_maps;
SELECT name FROM user_sdo_cached_maps
                 *
ERROR AT line 1:
ORA-00942: TABLE OR VIEW does NOT exist

If table or view does not exist is returned and not the statement “no rows selected”

SQL>@mcsdefinition.SQL

It will create the view USER_SDO_CACHED_MAPS for all users. This view is used to hold the map tile layer definitions and is required by MapViewer.

3.5 - Spatial Metadata

Run the mvdemo.sql with the account where you have load the data dump file to fill all the data properly.

After import of the dump file, perform this actions in SqlPlus - SqlPlus Command :

SQL> CONNECT mvdemo/mvdemo@orcl
Connected.
SQL> @mvdemo.SQL

Why ?

To make aware spatial that you have spatial data, you must insert geometry metadata by starting the mvdemo.sql script. An spatial index that need Mapviewer to read the data is also created.

Example for the table states :

UPDATE states a SET a.geom.sdo_srid=8307;
 
INSERT INTO USER_SDO_GEOM_METADATA VALUES (
	'STATES', 
	'GEOM', 
        MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', -180, 180, .00000005), 
                            MDSYS.SDO_DIM_ELEMENT('Y', -90, 90, .00000005)),
        8307);
 
CREATE INDEX STATES_SDX ON STATES(GEOM) 
indextype IS mdsys.spatial_index;

In the mvdemo.sql, you can see that the style, the theme and the map are also loaded.

INSERT INTO user_sdo_styles SELECT * FROM styles;
INSERT INTO user_sdo_themes SELECT * FROM themes;
INSERT INTO user_sdo_maps SELECT * FROM maps;
Advertising

4 - Map DataSource

In order for the MapViewer to find the data you just imported, you need to define a map datasource to the MapViewer. This can be done through the MapViewer home page (typically http://host:port/mapviewer), in the “Add a data source” form.

  • Log in as Admin with the Admin button (top right of the window)
  • Fill in the credential

If you need to login on OC4J, enter oc4jadmin for the login and its password

  • Go to Management Tab , DataSource and fill the form :

5 - Test

You are done with the installation. You will be able to see the demo :

If all work perfectly, you will see a map.

Enjoy !