IntroductionToMappinginOracleUsingHERE Maps
IntroductionToMappinginOracleUsingHERE Maps
a
Nokia
Business
Introduction
to
Mapping
and
Location
Analytics
in
Oracle
using
HERE
Map
Content
A
HERE
White
Paper
More and more, businesses are requiring the capability to show assets on a map, and, more importantly, to visualize their
key performance indicators geographically in a clear and concise way. This is driving applications developers, who
understand the need to easily add maps and analytics into their applications. HERE provides the geographic data that
fuels many of the location analytics and mapping applications in Oracle. This document provides an overview of the
capabilities available to Oracle users.
By
Dan
Abugov
Business
Development
Manager
and
Consultant
HERE
©
2014
Nokia
HERE,
a
Nokia
Business
2
Disclaimer
This content is provided "as-is" and without warranties of any kind, either express or implied, including, but not limited to,
the implied warranties of merchantability, fitness for a particular purpose, satisfactory quality and non-infringement.
NAVTEQ does not warrant that the content is error-free and NAVTEQ does not warrant or make any representations
regarding the quality, correctness, accuracy, or reliability of the content. You should therefore verify any information
contained in the content before acting on it.
To the furthest extent permitted by law, under no circumstances, including without limitation NAVTEQ's negligence, shall
NAVTEQ be liable for any damages, including, without limitation, direct, special, indirect, punitive, consequential,
exemplary and/or incidental damages that result from any content, even if NAVTEQ or an authorised representative has
been advised of the possibility of such damages.
1
Introduction
Oracle continues to invest making maps and location-enabled applications available to all developers and applications.
The use of Oracle database components like Oracle Locator and Oracle Spatial & Graph continues to expand rapidly, and
Oracle MapViewer is included in every Oracle Application Server/Fusion Middleware installation. These technologies are
enabling next generation mapping and location analysis capabilities in the Oracle database and application server.
More and more, businesses are requiring the capability to show assets on a map, and, more importantly, to visualize their
key performance indicators geographically in a clear and concise way. This is driving applications developers, who
understand the need to easily add maps and into their applications.
Oracle and HERE have been collaborating to provide turn-key map and other content specifically created for the Oracle
platform for over a decade This content conforms to the Oracle Locator and Oracle Spatial & Graph standards for
Mapping and Location Analysis, Geocoding, and Routing. HERE Map content includes pre-built tables and indexes and
installs in minutes using Oracle Transportable Tablespaces. HERE Map content is utilized by many Oracle Applications,
and HERE continues to innovate and create new content that enables new and enhanced usage withint the Oracle
ecosystem.
This paper will discuss the underlying technologies that make mapping and location analysis available in Oracle.
Oracle’s WebLogic Application server includes the ability to render maps for display in a wide variety of web-based
applications. The map rendering component of the application server is called Oracle Fusion Middleware MapViewer.
Putting mapping aside momentarily, the built-in location capabilities in all Oracle databases include the ability to analyze
information geographically, allowing us to answer questions such as:
In addition to mapping and the abovementioned analysis capabilities, Oracle Spatial & Graph is an option with Oracle
Enterprise Edition. Oracle Spatial & Graph includes advanced capabilities beyond the basic capabilities shown above,
with functionality such as Geocoding, Routing, Image Storage and retrieval, Network Analysis, Topology, Web Services,
and a lot more.
2.1
The
Spatial
Data
Type:
SDO_GEOMETRY
The Oracle database includes the SDO_GEOMETRY data type, which is used to store location data. Any table can
include one or more columns of type SDO_GEOMETRY. When creating a table use the SDO_GEOMETRY data type for
the column definition, or add a location column to an existing table in Oracle by using the ALTER TABLE command. The
syntax for adding a location column is:
Column naming conventions follow normal Oracle identifier rules. Above, the column name is LOCATION, but any
identifier can be used.
SDO_GEOMETRY is used to store the location on the surface of the Earth of a feature. What kind of feature?
It can define a point feature such as an address, an automobile location, a point of interest, a survey marker, etc.
Figure
1:
Point
feature
representation
Above, the school, the police and sheriff’s department, the courthouse, and the bus stop are all represented by a single
point.
SDO_GEOMETRY can also define a linestring to represent a linear feature such as a road, a river, or a railway line.
SDO_GEOMETRY can also define a polygon to represent an area feature such as a country, state, park, lake, harbor,
ocean, etc.
When features are included on a map, the map creator may decide to display them differently based on the zoom scale of
the map. For instance, San Diego International Airport is appropriately rendered as a point when zoomed out, but when
zoomed in it is rendered as a polygon.
Figure 4: Feature representations can change based on zoom level
Examples of SQL associated with location queries follow. Note the HERE Map data for most of the queries in this paper
are available in downloadable form from the Oracle Technology Network at:
http://www.oracle.com/technetwork/database/options/spatialandgraph/downloads/navteq-lic-168395.html
How many hotels are within two miles of Moscone Center? To answer this question we use a within distance query.
SELECT COUNT(*)
FROM NTC_MAP_POI_BUSINESS B, NTC_MAP_POI_HOTEL A
WHERE SDO_WITHIN_DISTANCE(A.GEOMETRY,B.GEOMETRY,
'DISTANCE=2 UNIT=MILE')='TRUE'
AND B.NAME='MOSCONE CENTER';
COUNT(*)
-------
319
We can extend this query as we can extend any SQL query. For instance, if we wanted to see how many Marriott or
Westin hotels are within two miles we could structure our query like this:
SELECT A.NAME
FROM NTC_MAP_POI_BUSINESS B, NTC_MAP_POI_HOTEL A
WHERE SDO_WITHIN_DISTANCE(A.GEOMETRY,B.GEOMETRY,
’DISTANCE=2 UNIT=MILE’)=’TRUE’
AND B.NAME='MOSCONE CENTER'
AND (A.NAME LIKE ’%MARRIOTT%’
OR A.NAME LIKE ’%WESTIN%’);
NAME
----------------------------------
MARRIOTT-FISHERMAN'S WHARF
JW MARRIOTT-SAN FRANCISCO
WESTIN-ST FRANCIS
MARRIOTT-SAN FRANCISCO-DOWNTOWN
WESTIN-SAN FRANCISCO MARKET STREET
Each of the previous queries allow users to do location analysis to solve a typical business problem, and yet none of them
required display on a map. One of the interesting and unusual pieces of Oracle’s location capabilities is that often the
results of location analysis provide information in which the results have no location component.
The second question we asked is how many of my customers have average household income of greater than $67,000?
To answer this question we use a relationship query, which tells us if there is a spatial interaction between an area of
interest and a search column. In the case below, the area of interest is each of the census demographic areas that have
a median income > $67,000, and the search column is the stored location of each of the customers.
SELECT COUNT(*)
FROM BLOCK_GROUP B, CUSTOMERS A
WHERE B.MED_HOUSEHOLD_INCOME > 67000
AND SDO_ANYINTERACT (A.LOCATION,GEOMETRY)='TRUE';
As with the previous query, this analysis can be extended to see what these customers tend to buy so marketing outreach
can be properly targeted. Also demographic analysis can be extended to look at number of children, population density,
race, or any one of a number of factors the census keeps track of. In addition, other spatial analysis can be incorporated
(do people who live near golf courses buy golf equipment, or do people who live near bodies of water buy insect repellent
and/or boat equipment and/or fishing gear).
The third question we asked above was: What is the closest ATM to my current location? To answer this question we
use a nearest neighbor query. Current location can be determined easily through interfaces creates for GPS and mobile
devices, and this kind of query is similar to those executed through programs running on those devices:
SELECT NAME
FROM NTC_MAP_POI_BUSINESS A
WHERE SDO_NN(A.GEOMETRY,
SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(
-122.40953, 37.79388, NULL),NULL,NULL),
'SDO_BATCH_SIZE=8')='TRUE'
AND A.CAT_ID = 3578
AND ROWNUM < 4;
NAME
------------------------------
BANK OF THE WEST
BNP PARIBAS
FIRST REPUBLIC BANK
To return the closest ATM of a specific type (in this case Bank of America) the previous query can be modified:
ADDR
---------------------------------
BANK OF AMERICA, 163 BRANNAN ST
BANK OF AMERICA, 345 3RD ST
BANK OF AMERICA, 55 HAWTHORNE ST
Oracle Spatial takes all of the functionality of Oracle Locator and expands it in many ways, some of which are useful to
the many applications that can utilize location analysis, and others which are quite specialized in their application and use
of the technology.
o Geocoding
o Geocoding is the process of assigning a longitude and latitude (the location on the Earth) to an
address. It is a major requirement of business and mapping applications. Once locations on the Earth
are assigned to addresses, spatial analysis and mapping is possible. HERE Map content enables
geocoding in Oracle.
o Raster Imagery Storage and Retrieval
o Linear Referencing
o Spatial Boolean Functions
o Topology Data Model
o Network Data Model, enabled for the Road Network with HERE Map Content
o LIDAR Data Storage and Retrieval (Point Clouds)
o Spatial Analysis and Mining
o Tin Storage and Retrieval
o Spatial Aggregation
o Spatial Web Services including:
o Geocoding
o Routing
! Routing used in Oracle applications to help people easily navigate between locations. In
addition, routing is used for transportation analysis (how much should I charge a customer if I
have to pick something up at location A and deliver it to location B) and for marketing analysis
(if I put a store at a particular location, how many customers can drive to it within a ten minute
drive time). HERE provides the routing data that is used by Oracle applications.
o Yellow Pages
o Web Catalog Service
0=>%?:&<4/%T,-*(.%M*;;4/A&:/%M&GU*/A/:%
Every Oracle Application Server includes MapViewer, a middle tier map drawing/rendering/mashup component.
MapViewer renders location data directly from the database and includes APIs to render data from other sources as well,
including HERE Platform Services.
In addition MapViewer uses centralized information (map metadata) that includes the rules associated with how maps are
styled and displayed to users. This map metadata is easily managed using the map authoring tool which is part of
MapViewer, called Map Builder.
MapViewer make is very easy for web-based/web accessible applications to include maps. MapViewer includes Java,
XML, Open Geospatial Consortium Web Mapping Service (OGC WMS), and JSP APIs
I*51/<!NJ!;/+28<!+/2B*.<2.1/<!:144(/.*-5!H+4!/<-0</*-5!
,-./(012.*(-!.(!3+44*-5!+-0!6(2+.*(-!7-+89.*2:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"!'()*+!#$%&!!!!!!!!!!!
,-!;/+28<!1:*-5!=>?>!3+4!@(-.<-.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
HERE,
a
Nokia
Business
12
• Styles
o Can control fill color, border color, line thickness, line style, text font and size, and so on
o Stored as XML in view USER_SDO_STYLES
• Themes
o A geometry column associated with a style
o A text label column can also be associated with a theme. The label column has its own style (size, font,
color, and other attributes)
o Stored as XML in view USER_SDO_THEMES
• Maps
o One or more themes
o Stored as XML in view USER_SDO_MAPS
Oracle Map Builder is Oracle’s map authoring tool created to manage map metadata. Oracle Map Builder creates and
manages XML metadata associated with styles, themes, and maps (plus a lot of other things) via a simple GUI.
Figure 8: MapViewer GUI eliminates the need to understand XML
Oracle JDeveloper simplifies the development of rich internet applications by providing an Application Development
Framework (ADF) that minimizes the requirements to write infrastructure code. It is based on a Model-View-Controller
design pattern:
Rich internet applications require full-featured user interfaces, and JDeveloper meets this need with ADF Faces. ADF
Faces includes a large set of predefined GUI components such as pie charts, bar charts, graphs, dials, etc. ADF Faces
also supports partial page rendering/AJAX.
Importantly, for this application ADF Faces also includes a geoMap component which simplifies the process of adding a
map and showing your business data in your internet application.
3
HERE
Map
Data
HERE, a Nokia business, provides turnkey content for mapping, location analytics, geocoding and routing that meets the
specification for inclusion in Oracle Application via Oracle Locator and Spatial. A data sample is available from the Oracle
Technology Network. Registered OTN users can download the data by logging into OTN and clicking this link:
http://www.oracle.com/technetwork/database/options/spatialandgraph/downloads/navteq-lic-168395.html
After deploying Oracle Fusion Middleware MapViewer into the application server, make sure to create a jdbc connection
to the database that is started whenever the application server is started. To do this, go to the MapViewer deployment
(for example: http://localhost:7001/mapviewer ).
Next, click on the Admin button in the upper right hand side of the MapViewer page:
On the configuration page, slide way down until you come to where the connection strings are defined. Add a connection
string for the HERE_SF user or the user you imported the sample data into. Make sure the connection string is not inside
an XML comment (not between <!-- and --> :
Note the jdbc_password is preceded by an exclamation point (!). When the application server is restarted the password is
encrypted. Next, at the bottom of the page, click on Save & Restart:
Now you are ready to use HERE Map Content in a mapping application.
About
HERE
HERE,
a
Nokia
business,
offers
HERE
Map
Content
and
the
HERE
Platform,
a
cloud-‐based
location
platform
that
delivers
the
world’s
best
maps
to
enterprises
and
governments
around
the
globe.
HERE
is
the
Oracle-‐preferred
supplier
of
geographic
content
to
Oracle
Applications.
To
learn
more
about
HERE,
visit
http://www.here.com/business/enterprise.