Thursday, July 24, 2008

In addition to the Satellite, street map, and hybrid map types, Google Maps also publishes a terrain map type. If you use the default GeoMedia WebMap 6.1 Publisher template to create a new Google Maps mashup, you will notice that there is no terrain button in the web page; only the Map, Satellite, Hybrid, and No Backdrop buttons are available. See the screen shot below.To enable the display of terrain shaded relief data from Google, you need to add in the terrain map type to the Google Maps javascript code. Here are the steps to do it.

Now, open up the mashup web page in an Internet browser. You should be able to see the Terrain button. Clicking on the button will display the terrain data in the map window as shown in the screen shot below.

There you go. Just remember, that the change in gm.js will be overwritten if you decide to republish the mashup again from GeoMedia WebMap Publisher.

Thursday, July 10, 2008

Oracle has been building spatial query tools inside the database engine for many years now since Oracle 8i. But I have not seen many examples of Microsoft Office applications that directly query a Oracle Spatial database for spatially related information without having to use any GIS vendors' software.

A simple example that came to my mind is an Office application that generates water usage demand reports by geographic regions. Here, I outline the steps I took to create a simple Excel VBA to query an Oracle Spatial database. The VBA will look for all point geometries INSIDE a polygon geometry to calculate the total demand by usage type and the results printed to an Excel sheet.

Create Sample Oracle DataFor my convenience, I used Intergraph's GeoMedia Professional 6.1 to create a couple of Oracle tables CUSTDATA and DEMANDPOLYGON with GEOMETRY fields. However, you can use any tool of your choice to create the spatial tables. Even plain SQL statements through the Oracle SQL*PLUS prompt is fine.

CUSTDATA holds point geometry data while DEMANDPOLYGON stores polygon geometries. After creating the tables, I inserted a few records inside the newly created tables. My sample data looks like the screen shot below.

Create an ODBC Data SourceIf you don't have an ODBC Data Source Name pointing to the Oracle schema, then you can use the Control Panel's ODBC Data Source Administrator to define one as shown in the two figures below.

Create a New VBA in Microsoft Excel

Bring up Microsoft Excel and create a new Excel Workbook. Then click Tools > Macros > Visual Basic Editor to bring up the VBA Editor.

Select Insert > UserForm to create a new form. By default, it is named as UserForm1.

Using the IDE's toolbox, add in the following controls: Label, ComboBox, and 2 CommandButtons. Arrange the controls as shown in the figure below. Name the CommandButton controls as cmdOK and cmdCancel.

Select View > Code to enter the VBA code for the UserForm1. Enter the following code.

In the VBA IDE' project pane, right click on the ThisWorkbook object and select View Code. Add in the following code.

Private Sub Workbook_Open() UserForm1.Show End Sub

Now save and close everything.

Running the Excel VBADouble click the Excel file you created previously. The Excel Workbook should open and you would be prompted with the following:

Choose a region from the drop down list and press OK. The Excel VBA would submit a spatial query to Oracle to find all the CUSTDATA records inside the selected demand polygon. The results are grouped, tabulated and displayed in the Excel spreadsheet as shown below.

NotesThe example code shown is quite unsophisticated. I have hardcoded the Oracle login, password and ODBC data source name. There is also no error handling at all. These are intentional as the example is just meant to illustrate a technique.

Wednesday, July 2, 2008

This must be a beginner's mistake but it stumped me for a couple of days. On a Windows XP SP2 notebook, I tried to run GeoMedia WebMap Publisher 6.1's Server Configuration Utility - but I kept getting a permission denied error message as shown below.I suspected the DCOM Config Access Permissions may not be granted with the correct permissions but I could not see it. I thought I had set all permissions as per according to the Web Map Publisher instructions. But then some kind soul from the GeoMedia Developer's forum pointed to me that the INTERACTIVE user needs to be granted access permission also in the Component Services.Once I did that, I had no problems bringing up the Publisher Server Configuration Utility.