GMapCreator Version 1.3


Index

  1. Introduction
  2. Quick Start
  3. Running the Program
  4. Menu Options
  5. Map Buttons
  6. Generate Panel
  7. Colour Thresholds
  8. Drawing Style
  9. Data Query Dialog
  10. Command Line Options
  11. Input File Formats
  12. HTML Template File Format
  13. Troubleshooting and Frequently Asked Questions

Introduction

The 'GMapCreator' is a Java application to automatically create Google Maps websites from data in Shapefiles or CSV files containing polygons, lines and points. This allows complex data to be represented on Google Maps and published on the web by simply copying files onto the web server. Any ISP providing basic hosting of homepages is suitable for use with this method as it does not require any special software to run on the server. The software requires the shapefile to contain geometry with numeric attributes as the maps are plotted using the value of the attributes to colour the areas.

The basic premise is to pre-render all the tiles necessary to publish a map by reducing the number of tiles required, either by limiting the maximum zoom level limit or the map's geographic area. For example, a map of the UK showing crime figures for each county would have a limited zoom level as zooming past the point where you can only see one coloured area is pointless. Similarly, for data of limited area like GPS tracked air pollution sensors in a 1KM square, the maximum zoom limit can be used as tiles are only created where there is data in the shapefile.

OAC screenshot

Example 1: Dan Vickers' Output Area Classification for London

NOTE: Google Maps are plotted with a Mercator projection. The GMapCreator application should be able to handle shapefiles in most common map projections as it re-projects the data when it is loaded. There could be some accuracy lost in situations where a different datum is used e.g. OSGB projections. In this situation, the TOWGS84 parameters in the shapefile's '.prj' file can be used to place the map in the correct position. Example data for building outlines has been successfully used with a high degree of accuracy. In the case where a datum shift or ellipsoid shift is required to re-project the data but no TOWGS84 parameters have been entered, a warning box will be displayed to warn of a potential accuracy problem when rendering the tiles.


Quick Start

The basic method for creating Google Maps websites is as follows:

  1. Start the GMapCreator program.
  2. Click on 'File/Open' and load in a shapefile.
  3. Use the drop down box in the map preview window to choose an attribute from the shapefile.
  4. Click on the 'Cols...' button and pick some colours, threshold values and descriptions for the areas in the shapefile (see: Colour Thresholds).
  5. Either use the 'Maximum Zoom Level' slider to limit the zoom level, or use the 'Zoom In' button in conjunction with the 'Limit to preview' check box to limit the geographic area created. Whatever zoom limits and geographic limits are chosen, the 'Tile Count' will show the number of tiles that will be created when 'Create' is clicked.
  6. Click on the 'Create' button and a dialog showing the number of tiles and the directory will be shown. Click on 'OK' to begin the creation process.
  7. Now in Windows, go to the directory containing the shapefile, where there will be an html file with the same name. Double click on this and the map will load.
  8. As a final step, use the 'File/Save Settings...' option to save the current setup to file. This way, all the zoom levels, colours and thresholds will be saved and can be loaded with the 'File/Load Settings...' option later.
  9. In order to publish the site on the web, the html file and the directory containing all the tiles called 'shapefilename-tiles' need to be copied to a web server. The API key will also need to be set correctly in the html file.

Running the Program

On Windows, the GMapCreator software is run from the 'Start Menu', under 'GMapCreator'. On other systems, there is no native installer, so the software must be run from the command line as follows:

java -Xms1024M -Xmx1024M -jar gmapcreator.jar
This assumes that the current directory is where the GMapCreator software has been unpacked to and that Java is in the system's path. The '-Xms1024M' and '-Xmx1024M' options can be changed as they specify how much memory is allocated to the Java Virtual Machine when it starts up.

The Windows installation includes two options on the 'Start' menu for running the software. The first, labelled 'GMapCreator', runs the program directly as a Java executable JAR file, using the Windows file association between the '.jar' extension and the 'java.exe' executable. The second, labelled 'GMapCreator (bat file)' runs a '.bat' file contained in the installation directory called 'run-gmc.bat'. This file contains a command line to start the GMapCreator and allows the user to pass options to the virtual machine on startup to increase the amount of memory allocated. The first option should work on all systems, while the second requires java to be in the system path. If not, then the 'run-gmc.bat' file can be edited and the fully qualified path to the Java executable can be entered there. The main purpose of this file is to allow the command line to be changed and the memory requirements set as required by the user, while allowing a simple way of executing the application from the 'Start' menu.

On startup, the application checks for the presence of the Java Advanced Imaging Toolkit (JAI). If this is not installed on the computer in the same virtual machine as the application is running from, then a warning box is displayed containing instructions on how to install it.


Menu Options

File Menu

File/Open...

Opens a file dialog that allows a shapefile to be loaded.

File/Load Settings...

Opens a file dialog that allows an xml file containing previously saved settings to be loaded. The settings files contain everything necessary to create the map, including the name of the shapefile, the maximum zoom level selected and all the colour thresholds.

File/Save Settings...

Saves the settings for the current map in an xml file.

Exit

Exits the application.


Edit Menu

Page Data

Opens a dialog containing options for customising the html page that is generated. All of these options can also be set by editing the html page after it is created, but for ease of use it is more convenient to enter the API key and map title here so everything happens automatically.

Page Data

The data that can be set is:

Google API Key Place your own API key here, otherwise the page will have to be edited manually if it is published on the web.
NOTE: the API key is unnecessary for web sites stored on a local disk as it is ignored by the Google Maps code when running locally.
API Version For advanced use only. Normally this will be left as 2. This setting controls the version of the Google Maps API loaded. It is used in the 'v=' section of the loading code to specify a particular API version in cases where the latest version is unusable e.g. 2.58 will force version 2.58 of the API to be used.
Map Title This text is entered into the title of the html frame and the title at the top of the window.

Use Custom HTML Template

This menu option controls whether the HTML template file used to create the HTML page for the map comes from the default internal template or from a user defined custom template stored in an external file. The menu shows with a tick next to it when a custom HTML template is being used. To return to the default internal template simply click on the option again to uncheck it. When the custom template option is activated, a file open dialog will appear prompting for the file containing the custom template. The file being used can be viewed or changed with the 'Set HTML Template...' option. This option is stored in the user preferences for the application, so will be remembered when the application is closed and re-opened.

Set HTML Template...

Clicking on this menu option displays a dialog box which allows the file used as the custom HTML template to be viewed and changed. This is only available if the 'Use Custom HTML Template' option is checked. See the 'HTML Template File Format' section for more information on how to create custom HTML templates.


Help Menu

About

Displays information about this application, including the version number and build number. Also displayed is the version of the Java virtual machine being used.

Help Topics

Displays help for this application.

Website

Opens up the CASA homepage in a browser.

MapTube

Opens up the MapTube homepage in a browser. MapTube is a website launched in February 2008 for sharing maps created using the GMapCreator. The benefit of uploading a map to MapTube is that it allows visual comparison of datasets using the MapTube interface.


Map Buttons

The map buttons located in the 'preview' panel control various aspects of how the map is drawn.

Preview Panel

Attribute Selection

Attribute Selection

The combobox on the left hand side changes the shapefile attribute displayed on the map. Click on the down arrow and change the currently selected attribute by clicking on it. The map will change to reflect the new attribute data.

NOTE: only attributes in the shapefile with numeric data will be visible.

Zoom In Zoom In (+) Button

Zoom in the current map display. The map area created with the 'Create' button will only be affected by the zoom level if 'Limit to Preview' is set. Otherwise the map will always be created to the maximum extents of the shapefile regardless of what is displayed on the screen.

Zoom Out Zoom Out (-) Button

Zoom out the current map display.

Colours Cols...

Colour button. Clicking this will display the colour dialog to allow the colours of the different areas to be changed (see: Colour Thresholds).

Style Style Button

This button displays a dialog that controls how points, lines and polygons are drawn on the map. Outlines can be switched on or off, the colour of the outlines can be changed and the plot size can be controlled (see: Drawing Style).


Generate Panel

The 'Generate Panel' on the right hand side of the main window controls the generation of the Google Maps site from the data in the shapefile. This panel only becomes active when a shapefile has been loaded, otherwise it will be greyed out. The controls on this panel are for limiting the number of files in the Google Map site that is created when the 'Create' button is pressed.

Generate Panel   The 'Generate Panel' with a slider to control the maximum zoom level, a count of the number of tiles, the 'Limit to Preview' check box and the 'Create' button.

The 'Maximum Zoom Level' slider controls the depth of the maximum zoom level of the Google Map that will be created. The maps are created by recursively splitting the area into four, so the greater the zoom level (higher numbers), the more map tiles are required and the more files are created. This can easily exceed the capacity of most desktop computer systems, so underneath the 'Max Zoom Level' slider is a counter to show how many tiles would be created with the current settings. As a guide, the London area with max zoom level 17 set requires almost 100,000 tiles and is likely to occupy about 0.5GB on disk.

The 'Limit to Preview' button limits the area created to the area currently visible in the map panel on the left. Normally, maps are created covering the entire area of the shapfile, but with this option set, the area can be chosen with the zoom in/out buttons and by dragging with the mouse on the map. By limiting the geographic area, the number of tiles created will also change.

Once the generate settings have been chosen, click on the 'Create' button to begin the create process. A dialog box will appear showing how many tiles are going to be created and which directory they will be created in. By default, the html file for the site is created in the same directory as the shapefile and has the same name, but with a '.html' extension. This can be changed later if required. The tiles are created in a directory with the same name as the shapefile, but with '-tiles' appended to it. If this is renamed, then the html file will need to be edited, otherwise the tiles will not be found. The html file uses relative references to the tiles directory, so as long as they are both in the same directory, they can be moved without problem. This also includes copying them onto a web server and accessing the page by http. If data is copied onto a web server, make sure the Google Maps API key is registered for the domain containing the site. The API key can easily be edited in the html file if it was incorrect when the create process was started.


Colour Thresholds

The colour thresholds dialog is used to define how the areas on the map are coloured. The value field links the threshold to the attribute value in the shapefile and gives it a colour. Where attribute values on the map are outside of the range of the value field, they are clamped to either the maximum or minimum colour in the scale. The value can be edited by double clicking and entering a new value, but the colour scale will always remain sorted by this field in ascending order. If the mouse is left over one of the items in the 'Value' column then a tooltip showing the range of attribute values for this colour appears. In the example below the mouse is over the '0.25' of the cyan colour threshold (row 2) and indicates that cyan stands for values between 0.25 and 0.5.

Colour Dialog

 

The use of the fields on the colour thresholds dialog are as follows:

Select

Used in conjunction with the 'Delete' button. Click on the check boxes next to the rows you want to delete and click the 'Delete' button to delete them..

Colour

Click on the colour bar to see a dialog allowing the colour for this threshold to be changed.

Colour Changer

Colours can be chosen by clicking on the desired colour on the 'swatches' tab, by hue, saturation and brightness on the 'HSB' tab or by entering the RGB values directly on the 'RGB' tab.

Value

This links the attribute field in the shapefile to this colour. Double click in the box and type in a new value to change it. The list of values will always remain in ascending order. The colour threshold values work on a less than basis e.g. if the threshold values are 1.0, 2.0, 3.0 then the groupings are: 1.0<=X<2.0 (first colour), 2.0<=X<3.0 (second colour), X>=3.0 (third Colour). Anything less than 1.0 is clamped to the 1.0 colour. When a dataset with discrete classifications is used, simply enter the classification labels and assign a colour to them. If a transition colour scale is used, the absolute ranges of the limits are not as critical because of the way the colours are interpolated (see: Transition and Discrete Options).

Description

Displayed on the resulting html page to describe the data represented on the map.

Add Button

Add a new coloured threshold onto the end of the current thresholds. The value and colour of this new threshold can then be edited.

Delete Button

Delete any selected colour thresholds. The row must first be selected by clicking in the 'Select' field.

Transition and Discrete Options

The areas can be coloured in one of two ways: discretely, or as a transition between colours.

Carbonmonoxide Data on a 5 metre grid
Colour Transition Colour Discrete
Transition colour scale Discrete colour scale

The figure above shows carbon monoxide data for an area around London on a 5 metre grid. In both maps, the colour scales are identical with black and red set to values 0 and 5 respectively. The only difference is that the image on the left has a transition colour scale, while the image on the right has a discrete one. With the transition colour scale, as the data value varies between thresholds, so the colour will be interpolated between the two thresholds either side of the value. In this case, the level of red indicates higher CO values. Where the value exceeds 5.0, the colour is clamped to the highest defined colour.

In the right hand image, where the colour scale has been switched to a discrete scale, there are only two possible colours that can be drawn on the map. Either the colour is black or red, with nothing in between. As before, if any values are above the red threshold, they appear as red. This example is only intended to show the difference between the two colouring methods and for a better example of where discrete colour bands have been used, refer to example 1 shown in the introduction.

More complex colour scales are possible using the transition scale. When a shapefile is first loaded, the default colour scale is a transition one using five colours: blue, cyan, green, yellow and red. The thresholds are equally spaced at 0, 0.25, 0.5, 0.75 and 1.0. The rule for colouring with multiple thresholds is to find the two colours that the value is between and then linearly interpolate between those two colours e.g. 0.875 is halfway between 0.75 and 1.0, therefore the colour is halfway between yellow and red, which results in orange.

In general, transition colour scales are best used when the data being visualised is a continuous quantity, while discrete scales are best used for classifications like demographics where there are a discrete number of possible labellings.

Query

The 'Query...' button brings up another dialog, allowing the user to see various statistics about the attribute field that the colour scale refers to. This dialog also contains a number of features for automatically building a colour scale automatically from these statistics. The 'Query' dialog is covered in a later section: Query Dialog.

Cancel

Cancel any changes to the colour scale and return the map to the colours and thresholds as they were before the colour dialog was opened.

Apply

Apply the current colour scale and threshold settings to the map, but keep the colour dialog open. The changes do not take permanent effect until the 'OK' button is clicked. This allows changes to be viewed before being committed.

OK

Apply the current colour scale and threshold settings permanently, close the colour dialog and return to the map window.


Drawing Style

The drawing style dialog controls how point, line and polygon data is displayed on the map. It is accessed from the 'Style...' button in the preview panel of the main map window.

Points

The controls on the 'Points' tab alter the colour, outlines, size and style of the points that are drawn on the map. This only applies for feature geometry in the shapefile that is of type 'Point' or 'Multipoint'. Lines and polygons are not affected by anything on this dialog.

Points Style

Colour

The 'Colour' group controls whether the colour of the point follows the colour scale colour or is a fixed colour. If 'Set Colour' is selected then the colour scale and thresholds are ignored completely and the point colour is always the colour defined by clicking on the 'Colour...' button next to it. This feature is useful if the shapefile contains more than one type of data, for example lines and points making up a rail network. In this situation, the rail lines can be coloured using the colour scale while the points showing the location of stations can all be fixed to black.

Outlines

The outlines around the point marker are controlled with the 'Draw Outlines' check box. When this is checked, an outline is drawn around every point in the colour determined using the 'Colour...' button.

Marker

This section control the size and style of the marker drawn at the point location. The drop down box for the 'Shape' allows the style of the marker to be changed as follows:

Circle Square Diamond Triangle Inverted Triangle Cross Plus

The number in the 'Size' box is the size of the square bounding box enclosing containing the point in pixels (the diameter for a circle). This size is modified according to the status of the 'Enable point size multiplier' check box. If this is checked on, then the point size is either multiplied by the zoom level or the value of the data field being displayed.

SizeEnable point size multiplierZoom levelData FieldtimesPlot size
8OffDisabledDisabledDisabled8 pixels
8OnOnOff2.58 pixels * zoom level (metres) * 2.5
8OnOffOn5.08 pixels * data field * 5.0

Lines

The 'Lines' tab control how shapefile features containing lines are drawn on the map. This only affects geometry data of type 'Line' and 'Multiline'. The controls on this dialog affect the colour and width of the line data.

NOTE: There are no outlines drawn for line data.

Line Style

Colour

The colour of the line will normally follow the colour scale colour for the attribute. If 'Set Colour' is selected, then the colour of the line is fixed and can be chosen using the 'Colour...' button.

Width

The width of the line is set using the 'Width' controls. This can be fixed to the specified number of pixels, or made to vary based on the zoom level or data value as follows:

WidthEnable line width multiplierZoom levelData FieldtimesLine Width
16OffDisabledDisabledDisabled16 pixels
16OnOnOff2.516 pixels * zoom level (metres) * 2.5
16OnOffOn5.016 pixels * data field * 5.0

Polygons

The 'Polygons' tab controls how polygons are drawn on the map. This only applies to features of type 'Polygon' and 'Multipolygon'.

Polygon Style

Colour

The colour of the polygons will follow the colour scale colour for the attribute by default. By selecting 'Set Colour' all polygons in the file will be drawn in the colour defined by clicking on the 'Colour...' button.

Outlines

When the 'Draw Outlines' check box is checked, outlines will be drawn around all the polygons in the data. The colour of the outline can be set by clicking on the 'Colour...' button.

Settings

Unlike the other tabs on the 'Style' dialog, the 'Settings' tab affects everything drawn on the map, whether it is point, line or polygon data.

Settings

Overlapping Data

Check this box if any of the data drawn on the map overlaps. The reason for having this setting is mainly to do with drawing multicoloured points. When the map is created, each tile is drawn individually. Where data overlaps tile boundaries, or two features overlap each other, edges can be visible where the overlaps occur. This happens because, without this option checked, the draw order is not consistent. In the case where a red and blue dot are drawn over each other on the edge between two tiles, on the left tile they might be drawn as blue over red and on the right the other way around. This leads to a half red and half blue dot. If the draw order does not affect the drawing of the data, then leaving this option off speeds up the tile creation process.

Points   Points
Tile edges are visible where the drawing order is different on adjacent tiles. The result of the 'Overlapping Data' option is apparent where the left image (off) shows tile edges caused be a random drawing order of points, while edges are not visible on the right (on) where the points are all drawn in a fixed order. This example has been deliberately constructed to show this problem in an immediately visible form, so real life examples should not be as extreme.

 

Multiple Layers

This option allows the creation of a Google Map from multiple layers of data contained in different shapefiles. When enabled, the tile creation process first checks to see whether a tile already exists and draws the new data over the top if it does. The method of use is to first load the bottom layer of data and use 'Create' to make the tiles with this option disabled and noting the directory where the tilesare created. Then load in a new shapefile and turn this option on. Create the tiles for the new layer, but this time turn the 'Multiple Layers' option on. After clicking 'Create' it is necessary to click on 'Change Dir...' to change the creation directory to the tile directory of the previous layer. The tiles for this layer will be drawn over the top of the previous layer. This process can be continued for any number of further layers.


Query Dialog

The query dialog is accessed through the 'Query...' button on the colour scale window. The purpose of this is to give the user some information about the data field that the colour scale refers to. The 'Data' section gives information on: minimum value, maximum value, mean, sum and the count of all the items.

The 'Discrete Values' section activates if the total number of discrete values in the data is less than 100. For demographic classifications, the data might only contain a handful of separate groups identified with numbers. If the number of distinct values detected in the data is small enough, then the data is classified as containing discrete values and the number of separate groups will be displayed. In this case, the 'Fit Thresholds' button will be enabled and clicking it will automatically fill the colour scale with the detected thresholds, picking a random colour scheme. This change to the colour scale can be seen immediately by moving the 'Data Statistics' window, but the changes cannot be applied to the map until this window is closed.

Query Data
Querying the data for the colour scale

Under 'Functions' are a number of automatic features to make defining a colour scale more automatic:

ButtonFunction
QuartilesThis button automatically sets the thresholds to a quartile colour scale where 25% of the data fits into each of the four colour ranges.
Set GroupsAnother dialog box pops up asking for a number of groups. Then the data is divided uniformly into this number or groups from the maximum to minimum values. For example, if min=0, max=50 and number of groups=5, then the groups are 0..10, 10..20, 20..30, 30..40 and 40..50
Random ColoursMove the 'Data Statistics' window off of the colour scale so that the colours are visible. Click this button and all the colours are randomized.

Click on 'OK' to return to the colour scale dialog. NOTE: if using any of these automatic functions has not had the expected effect, then clicking on the 'Cancel' button on the colour scale dialog will return the map


Command Line Operation

Release 1.3 of the GMapCreator can be run from the command line or as part of a batch file to allow the creation of maps as an automatic process. The syntax is as follows:

java -Xms1024M -Xmx1024M -jar gmapcreator.jar -dfile=mysettingsfile.xml

The -Xms and -Xmx settings are optional, but specify that the java virtual machine should start up with 1024MB of memory, which should be enough for most datasets. These numbers can be changed if needed.

The '-dfile=mysettingsfile.xml' part needs to be replaced with the filename of the map's settings file. This can include a path, but it might be easier to copy the 'gmapcreator.jar' file into the diectory where the settings file is located.


File Formats

The GMapCreator can load data in ESRI shapefile format, or as a comma separated variable (CSV) file format. Many sites on the Internet contain shapefiles that can be downloaded and manipulated with GIS software. If the CSV file format is used, then the geometry needs to be specified in the Java Topology Suite (JTS) format, followed by the attributes for this feature, separated by commas.

Further information on the two file formats is available at the following locations:

The shapefile format is a binary format and so requires the use of a GIS program or programming library to enable the creation of shapefiles from spatial and attribute data. The CSV file format is a text format and can be created and edited using a text editor like notepad. This format is not intended to handle large amounts of spatial data, but allows easier creation of geometry. The format is based on three primirive types: point, line and polygon. These can be extended into multipoint, multiline and multipolygon to handle more complex geometry. The first line of the CSV file must contain the field headings, the first of which must be the geometry. For example:

the_geom,Temperature,Pressure,WindSpeed
POINT (-0.134694 51.522025),12.6,1006.1,12.5
POINT (-0.135096 51.524100),13.1,1006.2,14.0
POINT (-0.133536 51.524776),9.5,1005.9,16.1

On the first line, this specifies that each following line has four attributes called 'the_geom' (the geometry), 'Temperature', 'Pressure' and 'WindSpeed' fields containing data. The following lines contain the geometry plus the 'Temperature' (12.6), 'Pressure' (1006.1) and 'WindSpeed' (12.5). Each line must conatin all these attributes, otherwise the file will not load. In this example, the geometry is a simple point with its position given as longitude and latitude in WGS84. If a projection file (.prj) exists with the same name as the CSV file, then the coordinate reference system will be taken from that, otherwise if none is specified, then the coordinate system will be assumed to be WGS84.

Line and polygon geometry can be specified as follows:

"LINESTRING ( -0.134694 51.522025, -0.135096 51.524100, -0.133536 51.524776 )"
"POLYGON ( (-0.134694 51.522025, -0.135096 51.524100, -0.133536 51.524776, -0.134694 51.522025) )"
Note the quotes around the whole statement which are required due to the commas separating the points. If the quotes are omitted, then the file loader can't tell where the geometry finishes and the first attribute starts. Also notice the extra set of brackets on the polygon and the fact that the first point and the last point are identical. Polygons must be closed in this way, otherwise they can't be loaded.

The following is an example of a file that can be loaded into the GMapCreator:

the_geom,index
"POINT ( -0.133580 51.524790 )",1
"MULTIPOINT ( -0.134150 51.524666, -0.133871 51.524417 )",2
"LINESTRING ( -0.136032 51.522352, -0.135179 51.521426, -0.132627 51.522450, -0.134568 51.524281, -0.134095 51.524497 )",3
"MULTILINESTRING ( (-0.135739 51.524204, -0.134437 51.524011), (-0.135210 51.523711, -0.134973 51.524509) )",4
"POLYGON ( (-0.135075 51.521745, -0.135210 51.521854, -0.134541 51.522095, -0.134433 51.521944, -0.135075 51.521745) )",5
"MULTIPOLYGON ( ( ( -0.134605 51.524423, -0.134390 51.524526, -0.134876 51.524930, -0.135059 51.524854, -0.134605 51.524423 ) ),
 ( ( -0.134438 51.524266, -0.134014 51.523895, -0.133818 51.523970, -0.134224 51.524362, -0.134438 51.524266 ) ) )",6

This displays as follows:

CSV Geometry Test
Geometry test data loaded from a CSV file

 

NOTE: The final multipolygon line is longer than the others and has been split onto a second line. Lines can be split in this way as long as the next feature line begins with the geometry e.g. "POINT", "MULTIPOINT", "LINESTRING", "MULTILINESTRING", "POLYGON" or "MULTIPOLYGON". Continuing the next feature on the same line as the previous one is illegal. For example, the following is not allowed:

"POINT ( -0.133580 51.524790 )",1     "POINT ( -0.133580 51.524790 )",2
 

HTML Template File Format

The HTML template used to make the final map page can be changed from the 'Custom HTML Template' and 'Change HTML Template...' options on the 'Edit' menu. When the 'Custom HTML Template' menu option is checked, the template is changed from the internal one to a user specified one. The file used can be seen or changed from the 'Change HTML Template...' menu option. This is used to specify an HTML file containing custom HTML tags which are used to create the Javascript code and the rest of the page for the map. Under the 'html-templates' directory where the GMapCreator is installed e.g. 'C:\Program files\CASA-UCL\GMapCreator', there are two example templates. The first, called 'default_template.html' is the one that is used internally, while 'simple_template.html' is a variation on the default one but without any of the CASA or UCL logos.

When creating the HTML page, the GMapCreator takes the custom tags in the HTML file and replaces them with values based on information to do with the map. The custom HTML tags which are needed when defining a new template are as follows:

HTML TagDescription
<%APIKEY>Replaced with the API version defined in the 'Page Data' for this map.
<%APIVERSION>Replaced with the API key defined in the 'Page Data'.
<%MAPTITLE>The title of this map.
<%MINLAT>The minimum latitude of a bounding box containing the map tiles. This value is used in conjunction with the minlon, maxlat and maxlon tags to form a bounding box enclosing the area containing custom tiles. This bounding box is used to prevent the Google Maps code from trying to retrieve a tile that doesn't exist.
<%MINLON>The minimum longitude of a bounding box containing the map tiles.
<%MAXLAT>The maximum latitiude of a bounding box containint the map tiles.
<%MAXLON>The maximum longitude of a bounding box containing the map tiles.
<%MAXZOOM>The maximum zoom level that this map is created to. This value is used when defining the maximum resolution of the map layer in the Google API, otherwise the code would attempt to zoom past the limit that the tiles have been created to, causing an error.
<%MAXZOOMP1>This is the maximum zoom level plus one. The map projection is always defined using the number of zoom levels rather than the maximum zoom level number which starts from zero. If tiles for zoom levels from 0 to 12 are created and the maxresolution of the tile layer is 12, then the projection object used must be defined with 13 zoom levels.
<%INITIALZOOM>The zoom level at which the map will first appear on the screen when loaded. This value is automatically set to be half way between the maximum and the miniumu,
<%CENTRELAT>The latitude that the map is centred on when first loaded. This is set to the centre of the bounding box containing the map.
<%CENTRELON>The longitude that the map is centred on when first loaded. this is set to the centre of the bounding box containing the map.
<%TILEDIR>The name of the directory containing the map tiles. This is usually a relative URL or file path, for example: shapefilename-tiles
<%COLOURSCALE>The colour scale data for the map is inserted at this point in the HTML as a table element.

Troubleshooting

Frequently Asked Questions

What is a shapefile?
A shapefile is the Geospatial data format invented by ESRI and used in their ArcGIS software. The following document outlines the format of a shapefile: http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf The shapefile is made up of three files with extensions of .shp, .dbf and .prj. The '.prj' file contains information used to place the coordinates in the .shp file in the correct location on the Earth. If this is missing, the data cannot be loaded by the GMapCreator. There are a number of freeware programs and libraries around that allow the creation and editing of shapefiles without having to use ArcGIS.
 
How do I edit attribute values in the GMapCreator?
It is not possible to edit the information stored in the shapefile due to the way the data is stored. The thinking behind this is that most people will have used a GIS package to create a shapefile, so it is better to use another package to do any GIS processing of the data rather than try and replicate basic GIS functionality in the GMapCreator. The current version does contain some helper functions to make creating a colour scale easier, but the underlying data is never edited.
 
I have a shapefile containing polygons, but need to create a Google Map overlay of just the outlines of the areas.
The obvious way to do this is to use a GIS package to make a new shapefile containing polylines from the original polygon shapefile. If this isn't possible, then there is a trick that can be used to make the polygons transparent and only draw their outlines. Load the shapefile, then click on the 'Style...' button. Select the 'Polygons' tab and make sure 'Set Colour' and 'Draw Outlines' are both checked. Use the button next to 'Set Colour' to choose the colour for the outlines that will be drawn. Now close the dialog with the 'OK' button, go back to the main window and do 'Save Settings..'. Then use a text editor (e.g. notepad) to open the settings xml file that you just saved. Find the section beginning with "<polygon>" (about 40 lines down). Two lines below that is a line similar to "<colour>ff000000</colour>". This should have the leading 'ff' changed to '00'. For example, ff123456 would become 00123456 and ffff00ff would become 00ff00ff. This number is the colour of the polygon area in hexadecimal with 8 bits per channel ARGB (Alpha, Red, Green, Blue), so you could make the polygon area 50% transparent red with the number 80ff0000. Finally, save the xml file in the text editor, go back to the GMapCreator and load the settings back in. You will now see that the polygons are transparent and only the outlines are visible. When the map is created you will have a map layer containing just the outlines.
 
Why do I get a coordinate reference system error when I try and load a shapefile?
This message implies that the application cannot tell what coordinate system the data in the shapefile is in. Look for a corresponding '.prj' projection file in the same directory as the '.shp' file. If this does not exist then you will need to create one. A number of 3rd party applications create shapefiles without corresponding projection files. If this is the case, you will often find an option to force the creation of one. The problem is that a shapefile without a projection file can be displayed without a problem, but can't be lined up on Google Maps correctly. The information in the projection file is simply the 'Well Known Text' as specificed by the Open Geospatial Consortium, so it is possible to create one by hand using notepad. The correct information can often be found on the Internet, or the projection file for another shapefile known to be in the same projection can be used by copying and renaming it.
 
Why do I get an error box saying 'Error reprojecting to Mercator1SP' containing a message about 'CRS being null' when I try and load a shapefile?
This message indicates a problem reprojecting the shapefile into the WGS84 and Mercator projections required to create the maps. Look for a corresponding '.prj' projection file in the same directory as the '.shp' file. If this does not exist then you will need to create one. If the projection file does exist then try opening it in notepad and check that it is correct. The format of the file is the 'Well Known Text' specification as defined by the Open Geospatial Consortium.
 
Why doesn't the data fit the outline of the map exactly?
The information in the .prj file is wrong. If the data in the shapefile is using a different datum from WGS84, when the shapefile is loaded in and reprojected positioning errors will be present. The reprojection allows a lenient datum shift so that you will always get something displayed, even if the map is in slightly the wrong position. If the correct information to do the transformation is included in the .prj file then the map will match Google's map exactly. This is often a problem with data from Ordnance Survey, which is in OSGB36 coordinates. Adding the relevant Bursa Wolf parameters in the 'TOWGS84' section of the .prj file will fix this problem.
 
I've forgotten to add the title, API key or colour scale descriptions before pressing 'Create'. Do I have to create the map again?
The resulting html file can easily be edited after creation. The title of the window and the map can be changed in the <title> tag in the html head at the top of the file. Further down in the main body is a table containing the map title between <h1> tags. The API key is in the html head in the <script> tag where 'src' is the location of the Google Maps code. Insert the correct API key after the text 'key='. The colour scale descriptions can be found at the end of the html body. Look for 'class="scale_colour"' and you will find a list of <tr> tags with two <td> tags inside. The first <td> tag is the coloured box, the second is the description for this colour scale.
 
When I try and load a shapefile, nothing happens.
This could be caused by a number of problems, but is most likely when trying to load large shapefiles as the Java Virtual Machine runs out of memory. Open a command prompt window (click 'Start', 'Run' and type 'cmd' followed by enter). Then go to the directory where the application was installed (e.g. type 'cd C:\Program Files\CASA-UCL\GMapCreator'). Now type 'java -jar gmapcreator.jar' followed by return. Load the problematic shapefile as before and any error messages should be visible in the command window. If the problems appear to be due to running out of memory then run the application with the command 'java -Xms512M -Xmx1024M -jar gmapcreator.jar'. This changes the initial Java heap size to 512MB and allows it to grow to 1024MB, which is greater than the default setting. If this is still not enough and there is available memory on the computer then the 1024 can be increased even further. These settings have been used to load shapefiles in excess of 150MB.
 
How do I use data from multiple shapefiles?
Use the 'Multiple Layers' option on the 'Settings' page of the 'Style' dialog to render successive layers over an existing set of tiles. See the Style section for more information.
 
How do I use the GMapCreator on x64 machines?
The software is written in Java and will use the default virtual machine, whether it is 64 bit or 32 bit. The problem is the dependency of the software on JAI, which Sun have yet to release a native Windows x64 installer for. Versions for 64 bit Linux exist (AMD64), but there is no native binary for Windows and the code is not present in CVS, so cannot be compiled and built. The work around on the JAI website is to use the pure Java version with no native acceleration. If this is installed into the classpath then the GMapCreator will find and use it automatically. Using this method we have been able to use the GMapCreator on a 4GB Vista x64 machine to load a 360MB shapefile. The Java Virtual Machine under 64 bit is able to address more memory than the 32 bit one on the same machine, which was limited to around 1GB despite having 4GB of memory. Until a native x64 JAI is released, it is probably better to use GMapCreator under 32 bit on Windows as it is likely to create the tiles faster due to the native acceleration. If the shapefile is too large to load, then use 64 bit and accept that creation will be slower.