What this is all about...
This is a demo to show the capabilities of
the GeoTools MDX data store coupled with the GeoServer map server.
An exec summary is available
here
The goal of this software is to build a lightweight, minimal but
useful bridge between OLAP and GIS, in other words, to build a software that:
- Can add a minimal set of geographic functions to Mondrian without
the need to have a dedicated Mondrian build (just add a JAR to the lib
directory of Mondrian)
- Lets GeoServer produce maps out of OLAP data sources using MDX
queries
- Enables an OLAP data warehouse to have geograpphic features without
the need of a dedicated spatial component (just use a TEXT column in your table)
In addition to this "readme", there are two other panes in this application:
The "Catalog" pane shows the catalog of MDX queries that are
"geo-enabled" (via columns storing WKT geometry).
Click on one of the row to select the layer associated with it
and proceed to the "map" pane.
The "Map" pane shows the map. You should first select the style
in which to style the map then click "Show maps" to have the maps
disdplayed (optionally, you may add a background layer to the maps).
More technically, the architecture of this demo is composed of:
- A PostgreSQL/PostGIS database. Since the data are stored as WKT geometries
in a text column, there is no need of PostGIS once data have been converted
into WKT format.
- A Pentaho Mondrian OLAP engine
- A demo web application hosed on the Jetty servlet container
The MDX Data store is a GeoTools component that read an MDX query from a
Mondrian store and converts the geometry dimension into GeoTools features and
its measures and dimensions into feature attributes.
The prepared MDX queries are stored in the OLAP itself, as a separate cube
that is read by the data store: each query in the catalog cube becomes a
feature layer in GeoServer.
Warning: the display of maps may be slow (after all, the store is still in alpha version), especially
if you select the "states" query.
Warning: this application has been tested on FireFox 3.6, Google Chrome 8.0,
Internet Explorer 8 but the SVG map works only on Chrome.
Examples of geo-enabled MDX queries
In addition to let GeoServer serve maps straight out of OLAP data warehouses,
a set of geographic Mondrian user-defined function has been developed to perform
geographic queries on Mondrian.
For the time being only 6 functions have been defined:
- MemberToGeometry (returns a String out of a Member, in order to use both
a Member or a String to specify a geometry)
- Contains (returns true if the first argument contains the second)
- IsWithinDistance (returns true if the first argument is within a given
distance from the second argument)
- Merge (returns a geometry made up of the geometies contained in the
first argument (a Set))
- Area (returns the computed area of the geometry given as first argument)
- Length (returns the lenght/perimeter of the geometry given as first argument)
These functions can be used to in the MDX queries used for defining
the datasets used by GeoServer to draw maps or just to restrict the data returned
by non-GeoServer MDX queries. Some example of the latter case follows:
Computes the areas of subregions and use it as a measure.
WITH MEMBER [Measures].[Area] AS
'Area(MemberToGeometry([Geometry].CurrentMember))',
FORMAT_STRING = "##0.##"
SELECT {[Measures].[Area], [Measures].[Land]} ON COLUMNS,
{Filter({[Geometry].Children}, [Measures].[Land] > 0)} ON ROWS
FROM [States]
Returns states containing the point (-120, 43). You can see the resulting map
by choosing the "selstates" query.
WITH MEMBER [Measures].[Within] AS
'Aggregate(
Filter({[Geometry].[WKTState].Members},
Contains(MemberToGeometry([Geometry].[WKTState].CurrentMember), "POINT(-120 43)")
),
[Measures].[Land])'
SELECT {[Measures].[Within]} ON COLUMNS,
{[Geometry].[All]} ON ROWS
FROM [States]
Returns the Geometry as a measure (it as been defined as a property in the
Mondrian schema).
with member [Measures].[Geometry] as
'[Geography].CurrentMember.Properties("Geometry")'
select {[Measures].[Geometry]} ON COLUMNS,
NON EMPTY {[Geography].Children} ON ROWS
from [States]