Table of Contents

Mapviewer - SH Customer Density Semi-Static Map

Prerequisites

You must have the sh schema and the spatial demo files installed.

You can also do it with your own map : MapBuilder - Import of a Shapefile Map

Create the spatial data

As sys :

GRANT SELECT ANY TABLE TO MVDEMO;

As mvdemo :

create table t_sh_customer_density as (
select STATE_ABRV, 
(
select count(distinct T245.CUST_ID)
from 
     SH.COUNTRIES T175,
     SH.CUSTOMERS T186,
     SH.SALES T245
where  
  T175.COUNTRY_ID = T186.COUNTRY_ID 
  and T175.COUNTRY_NAME = 'United States of America' 
  and T186.CUST_ID = T245.CUST_ID
  and state_abrv = T186.CUST_STATE_PROVINCE
) CountCustomers, 
geom  
from
mvdemo.states
)
insert into USER_SDO_GEOM_METADATA values (
    'sh_customer_density', 
    'GEOM', 
        MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', -180, 180, .00000005), 
                            MDSYS.SDO_DIM_ELEMENT('Y', -90, 90, .00000005)),
        8307);

create index t_sh_customer_density_SDX on t_sh_customer_density(GEOM)
indextype is mdsys.spatial_index;

Create the Bucket Style

Mapbuilder Sh Cust Density Advanced Style

Create the theme

Mapbuilder Theme Sh Cust Density Parameters

Mapbuilder Theme Sh Cust Density Style

Set the attributes of theme

With Oracle Maps, labels are manifest as tool-tips on mouse-over the feature on the map.

Mapviewer Theme Attributes

Preview of the theme

cx : -96.554346 cy : 38.987208 height : 42.081234

Theme Sh Cust Density Preview

Create the base map

Mapbuilder Sh Cust Density Map

Create the Map Tile Layer

Location :

Sh Cust Density Create Map Tile Layer

Zoom Level Definition :

Level Scale Tile width
0 1.5E8 91.71616894864779

To know more about how to define the zoom level : Point Center and Zoom Level Definition

Show the map in a web page

The tutorial is provided with the installation of MapViewer on this url :

<script language=javascript>
  function showMap()
  {	
    var baseURL  = "http://"+document.location.host+"/mapviewer";
    var mapCenterLon =  -96.554346;
    var mapCenterLat =  38.987208;
    var mapZoom      =  0;
    var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
    var mapview = new MVMapView(document.getElementById("map"), baseURL);
    mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.SH_CUST_DENSITY_MAP")); 
    mapview.setCenter(mpoint); 
    mapview.setZoomLevel(mapZoom);    
    mapview.display();  			
  }
</script>

Support

See this article on how to retrieve debug information : Mapviewer debugging - log

interface not supported without a spatial index

You have forgotten to create the spatial index.

Message:Exception while querying theme: THEME_SH_CUST_DENSITY
Description: Nested exception is:
java.sql.SQLException: ORA-13226: interface not supported without a spatial index
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 8
ORA-06512: at "MDSYS.SDO_3GL", line 1173