helpgmapcreator version 1.3

Upload: fernando-kjuro-arenas

Post on 04-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 HelpGMapCreator Version 1.3

    1/22

    GMapCreator Version 1.3

    Index

    Introduction1.Quick Start2.Running the Program3.Menu Options4.

    File MenuEdit MenuHelp Menu

    Map Buttons5.Generate Panel6.Colour Thresholds7.

    Drawing Style8.Data Query Dialog9.Command Line Options10.Input File Formats11.HTML Template File Format12.Troubleshooting and Frequently Asked Questions13.

    Introduction

    The 'GMapCreator' is a Java application to automatically create Google Maps websites from data inShapefiles 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 notrequire any special software to run on the server. The software requires the shapefile to containgeometry with numeric attributes as the maps are plotted using the value of the attributes to colour theareas.

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

    Page 1 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    2/22

    Example 1: Dan Vickers' Output Area Classification for London

    NOTE: Google Maps are plotted with a Mercator projection. The GMapCreator application should beable 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. OSGBprojections. In this situation, the TOWGS84 parameters in the shapefile's '.prj' file can be used toplace the map in the correct position. Example data for building outlines has been successfully usedwith 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 towarn of a potential accuracy problem when rendering the tiles.

    Quick Start

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

    Start the GMapCreator program.1.Click on 'File/Open' and load in a shapefile.2.Use the drop down box in the map preview window to choose an attribute from the shapefile.3.Click on the 'Cols...'button and pick some colours, threshold values and descriptions for theareas in the shapefile (see: Colour Thresholds).

    4.

    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 areacreated. Whatever zoom limits and geographic limits are chosen, the 'Tile Count' will show thenumber of tiles that will be created when 'Create' is clicked.

    5.

    Click on the 'Create'button and a dialog showing the number of tiles and the directory will beshown. Click on 'OK' to begin the creation process.6.

    Now in Windows, go to the directory containing the shapefile, where there will be an html filewith the same name. Double click on this and the map will load.

    7.

    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/LoadSettings...' option later.

    8.

    In order to publish the site on the web, the html file and the directory containing all the tilescalled 'shapefilename-tiles' need to be copied to a web server. The API key will also need tobe set correctly in the html file.

    9.

    Page 2 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    3/22

    Running the Program

    On Windows, the GMapCreator software is run from the 'Start Menu', under 'GMapCreator'. On othersystems, 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 andthat Java is in the system's path. The '-Xms1024M' and '-Xmx1024M' options can be changed as theyspecify 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 Windowsfile 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 thevirtual machine on startup to increase the amount of memory allocated. The first option should workon 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 mainpurpose of this file is to allow the command line to be changed and the memory requirements set asrequired 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). Ifthis 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. Thesettings files contain everything necessary to create the map, including the name of the shapefile, themaximum 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.

    Page 3 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    4/22

    Edit Menu

    Page Data

    Opens a dialog containing options for customising the html page that is generated. All of theseoptions 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.

    The data that can be set is:

    Google APIKey

    Place your own API key here, otherwise the page will have to be edited manually if itis published on the web.NOTE: the API key is unnecessary for web sites stored on a local disk as it isignored by the Google Maps code when running locally.

    API Version For advanced use only. Normally this will be left as 2. This setting controls theversion of the Google Maps API loaded. It is used in the 'v=' section of the loadingcode to specify a particular API version in cases where the latest version is unusablee.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 thewindow.

    Use Custom HTML Template

    This menu option controls whether the HTML template file used to create the HTML page for themap comes from the default internal template or from a user defined custom template stored in anexternal file. The menu shows with a tick next to it when a custom HTML template is being used. Toreturn to the default internal template simply click on the option again to uncheck it. When the customtemplate option is activated, a file open dialog will appear prompting for the file containing thecustom 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 whenthe 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 HTMLtemplate 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 tocreate custom HTML templates.

    Page 4 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    5/22

    Help Menu

    About

    Displays information about this application, including the version number and build number. Alsodisplayed 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 forsharing maps created using the GMapCreator. The benefit of uploading a map to MapTube is that itallows 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.

    Attribute Selection

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

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

    Zoom In (+) Button

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

    Page 5 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    6/22

    Zoom Out (-) Button

    Zoom out the current map display.

    Cols...

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

    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 becontrolled (see: Drawing Style).

    Generate Panel

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

    The 'Generate Panel' with a

    slider to control the maximumzoom level, a count of thenumber of tiles, the 'Limit toPreview' check box and the'Create'button.

    The 'Maximum Zoom Level' slider controls the depth of the maximum zoom level of the GoogleMap 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 arecreated. 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 currentsettings. As a guide, the London area with max zoom level 17 set requires almost 100,000 tiles and islikely 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 onthe 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. Bylimiting the geographic area, the number of tiles created will also change.

    Page 6 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    7/22

    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 theywill be created in. By default, the html file for the site is created in the same directory as the shapefileand has the same name, but with a '.html' extension. This can be changed later if required. The tilesare created in a directory with the same name as the shapefile, but with '-tiles' appended to it. If this isrenamed, then the html file will need to be edited, otherwise the tiles will not be found. The html fileuses 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 thepage by http. If data is copied onto a web server, make sure the Google Maps API key is registered forthe domain containing the site. The API key can easily be edited in the html file if it was incorrectwhen 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 fieldlinks the threshold to the attribute value in the shapefile and gives it a colour. Where attribute valueson the map are outside of the range of the value field, they are clamped to either the maximum orminimum 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 leftover one of the items in the 'Value' column then a tooltip showing the range of attribute values for thiscolour 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.

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

    Page 7 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    8/22

    Select

    Used in conjunction with the 'Delete'button. Click on the check boxes next to the rows you want todelete 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.

    Colours can be chosen by clicking on the desired colour on the 'swatches' tab, by hue, saturation andbrightness 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 newvalue 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

  • 7/29/2019 HelpGMapCreator Version 1.3

    9/22

    Add Button

    Add a new coloured threshold onto the end of the current thresholds. The value and colour of this newthreshold 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

    Transition colour scale Discrete colour scale

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

    In the right hand image, where the colour scale has been switched to a discrete scale, there are onlytwo possible colours that can be drawn on the map. Either the colour is black or red, with nothing inbetween. As before, if any values are above the red threshold, they appear as red. This example isonly intended to show the difference between the two colouring methods and for a better example ofwhere 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

    Page 9 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    10/22

    thresholds are equally spaced at 0, 0.25, 0.5, 0.75 and 1.0. The rule for colouring with multiplethresholds is to find the two colours that the value is between and then linearly interpolate betweenthose two colours e.g. 0.875 is halfway between 0.75 and 1.0, therefore the colour is halfway betweenyellow and red, which results in orange.

    In general, transition colour scales are best used when the data being visualised is a continuousquantity, 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 theattribute field that the colour scale refers to. This dialog also contains a number of features forautomatically building a colour scale automatically from these statistics. The 'Query' dialog is coveredin a later section: Query Dialog.

    Cancel

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

    Apply

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

    OK

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

    Drawing Style

    The drawing style dialog controls how point, line and polygon data is displayed on the map. It isaccessed 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 drawnon 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.

    Page 10 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    11/22

    Colour

    The 'Colour' group controls whether the colour of the point follows the colour scale colour or is afixed colour. If'Set Colour' is selected then the colour scale and thresholds are ignored completelyand the point colour is always the colour defined by clicking on the 'Colour...'button next to it. Thisfeature is useful if the shapefile contains more than one type of data, for example lines and pointsmaking up a rail network. In this situation, the rail lines can be coloured using the colour scale whilethe 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 thisis 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 TriangleInvertedTriangle

    Cross Plus

    The number in the 'Size'box is the size of the square bounding box enclosing containing the point inpixels (the diameter for a circle). This size is modified according to the status of the 'Enable point size

    Page 11 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    12/22

    multiplier' check box. If this is checked on, then the point size is either multiplied by the zoom levelor the value of the data field being displayed.

    SizeEnable point size

    multiplierZoomlevel

    DataField

    times Plot size

    8 Off Disabled Disabled Disabled 8 pixels

    8 On On Off 2.5 8 pixels * zoom level (metres) *2.5

    8 On Off On 5.0 8 pixels * data field * 5.0

    Lines

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

    NOTE: There are no outlines drawn for line data.

    Colour

    The colour of the line will normally follow the colour scale colour for the attribute. If 'Set Colour' isselected, 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 ofpixels, or made to vary based on the zoom level or data value as follows:

    Page 12 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    13/22

    WidthEnable line width

    multiplierZoomlevel

    DataField

    times Line Width

    16 Off Disabled Disabled Disabled 16 pixels

    16 On On Off 2.516 pixels * zoom level (metres)* 2.5

    16 On Off On 5.0 16 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'.

    Colour

    The colour of the polygons will follow the colour scale colour for the attribute by default. Byselecting '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 thedata. The colour of the outline can be set by clicking on the 'Colour...'button.

    Page 13 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    14/22

    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.

    Overlapping Data

    Check this box if any of the data drawn on the map overlaps. The reason for having this setting ismainly to do with drawing multicoloured points. When the map is created, each tile is drawnindividually. Where data overlaps tile boundaries, or two features overlap each other, edges can bevisible where the overlaps occur. This happens because, without this option checked, the draw order isnot consistent. In the case where a red and blue dot are drawn over each other on the edge betweentwo 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.

    Page 14 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    15/22

    Tile edges are visible where the drawing order is different on adjacent tiles. The result of the 'Overlappipoints, while edges are not visible on the right (on) where the points are all drawn in a fixed order. Thisexamples should not be as extreme.

    Multiple Layers

    This option allows the creation of a Google Map from multiple layers of data contained in differentshapefiles. When enabled, the tile creation process first checks to see whether a tile already exists anddraws the new data over the top if it does. The method of use is to first load the bottom layer of dataand use 'Create' to make the tiles with this option disabled and noting the directory where the tilesarecreated. Then load in a new shapefile and turn this option on. Create the tiles for the new layer, butthis 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

    Page 15 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    16/22

    this layer will be drawn over the top of the previous layer. This process can be continued for anynumber 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 allthe items.

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

    Querying the data for the colour scale

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

    Button Function

    QuartilesThis button automatically sets the thresholds to a quartile colour scale where 25% of thedata fits into each of the four colour ranges.

    Page 16 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    17/22

    Set Groups

    Another dialog box pops up asking for a number of groups. Then the data is divideduniformly into this number or groups from the maximum to minimum values. Forexample, 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

    RandomColours

    Move 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 functionshas not had the expected effect, then clicking on the 'Cancel'button on the colour scale dialog willreturn 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 allowthe 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 upwith 1024MB of memory, which should be enough for most datasets. These numbers can be changedif 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 wherethe 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 manipulatedwith GIS software. If the CSV file format is used, then the geometry needs to be specified in the JavaTopology 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:

    http://www.esri.com/library/whitepapers/pdfs/shapefile.pdfhttp://www.vividsolutions.com/JTS/JTS%20Technical%20Specs.pdf

    The shapefile format is a binary format and so requires the use of a GIS program or programminglibrary 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 intendedto handle large amounts of spatial data, but allows easier creation of geometry. The format is based onthree primirive types: point, line and polygon. These can be extended into multipoint, multiline andmultipolygon to handle more complex geometry. The first line of the CSV file must contain the fieldheadings, 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.5POINT (-0.135096 51.524100),13.1,1006.2,14.0POINT (-0.133536 51.524776),9.5,1005.9,16.1

    Page 17 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    18/22

    On the first line, this specifies that each following line has four attributes called 'the_geom' (thegeometry), 'Temperature', 'Pressure' and 'WindSpeed' fields containing data. The following linescontain the geometry plus the 'Temperature' (12.6), 'Pressure' (1006.1) and 'WindSpeed' (12.5). Eachline must conatin all these attributes, otherwise the file will not load. In this example, the geometry isa 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 fromthat, 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.13469

    Note the quotes around the whole statement which are required due to the commas separating thepoints. If the quotes are omitted, then the file loader can't tell where the geometry finishes and the firstattribute starts. Also notice the extra set of brackets on the polygon and the fact that the first point andthe 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.134"MULTILINESTRING ( (-0.135739 51.524204, -0.134437 51.524011), (-0.135210 51.523711

    "POLYGON ( (-0.135075 51.521745, -0.135210 51.521854, -0.134541 51.522095, -0.13443"MULTIPOLYGON ( ( ( -0.134605 51.524423, -0.134390 51.524526, -0.134876 51.524930,

    ( ( -0.134438 51.524266, -0.134014 51.523895, -0.133818 51.523970, -0.134224 51.52

    This displays as follows:

    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".

    Page 18 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    19/22

    Continuing the next feature on the same line as the previous one is illegal. For example, the followingis 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 HTMLTemplate' and 'Change HTML Template...' options on the 'Edit' menu. When the 'CustomHTML Template' menu option is checked, the template is changed from the internal one to a userspecified one. The file used can be seen or changed from the 'Change HTML Template...' menuoption. This is used to specify an HTML file containing custom HTML tags which are used to createthe Javascript code and the rest of the page for the map. Under the 'html-templates' directory wherethe GMapCreator is installed e.g. 'C:\Program files\CASA-UCL\GMapCreator', there are two exampletemplates. 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 andreplaces them with values based on information to do with the map. The custom HTML tags whichare needed when defining a new template are as follows:

    HTML Tag Description

    Replaced with the API version defined in the 'Page Data' for this map.

    Replaced with the API key defined in the 'Page Data'.

    The title of this map.

    The minimum latitude of a bounding box containing the map tiles. This value isused in conjunction with the minlon, maxlat and maxlon tags to form abounding 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'texist.

    The minimum longitude of a bounding box containing the map tiles.

    The maximum latitiude of a bounding box containint the map tiles.

    The maximum longitude of a bounding box containing the map tiles.

    The maximum zoom level that this map is created to. This value is used whendefining the maximum resolution of the map layer in the Google API, otherwisethe code would attempt to zoom past the limit that the tiles have been created to,causing an error.

    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 levelnumber which starts from zero. If tiles for zoom levels from 0 to 12 are createdand the maxresolution of the tile layer is 12, then the projection object usedmust be defined with 13 zoom levels.

    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 theminiumu,

    The latitude that the map is centred on when first loaded. This is set to thecentre of the bounding box containing the map.

    Page 19 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    20/22

    The longitude that the map is centred on when first loaded. this is set to thecentre of the bounding box containing the map.

    The name of the directory containing the map tiles. This is usually a relativeURL or file path, for example: shapefilename-tiles

    The colour scale data for the map is inserted at this point in the HTML as a tableelement.

    Troubleshooting

    Frequently Asked Questions

    What is a shapefile?

    A shapefile is the Geospatial data format invented by ESRI and used in their ArcGIS software. Thefollowing document outlines the format of a shapefile:http://www.esri.com/library/whitepapers/pdfs/shapefile.pdfThe shapefile is made up of three fileswith extensions of .shp, .dbf and .prj. The '.prj' file contains information used to place the coordinatesin 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 creationand 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. Thethinking behind this is that most people will have used a GIS package to create a shapefile, so it isbetter to use another package to do any GIS processing of the data rather than try and replicate basicGIS functionality in the GMapCreator. The current version does contain some helper functions tomake 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 outlinesof the areas.

    The obvious way to do this is to use a GIS package to make a new shapefile containing polylinesfrom the original polygon shapefile. If this isn't possible, then there is a trick that can be used tomake 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 bothchecked. 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 sectionbeginning with "" (about 40 lines down). Two lines below that is a line similar to"ff000000". 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 ofthe polygon area in hexadecimal with 8 bits per channel ARGB (Alpha, Red, Green, Blue), so youcould make the polygon area 50% transparent red with the number 80ff0000. Finally, save the xmlfile in the text editor, go back to the GMapCreator and load the settings back in. You will now seethat the polygons are transparent and only the outlines are visible. When the map is created you willhave a map layer containing just the outlines.

    Why do I get a coordinate reference system error when I try and load a shapefile?

    Page 20 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    21/22

    This message implies that the application cannot tell what coordinate system the data in the shapefileis in. Look for a corresponding '.prj' projection file in the same directory as the '.shp' file. If this doesnot exist then you will need to create one. A number of 3rd party applications create shapefileswithout corresponding projection files. If this is the case, you will often find an option to force thecreation of one. The problem is that a shapefile without a projection file can be displayed without aproblem, but can't be lined up on Google Maps correctly. The information in the projection file issimply 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 theprojection file for another shapefile known to be in the same projection can be used by copying andrenaming 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 Mercatorprojections required to create the maps. Look for a corresponding '.prj' projection file in the samedirectory as the '.shp' file. If this does not exist then you will need to create one. If the projection filedoes 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 fromWGS84, when the shapefile is loaded in and reprojected positioning errors will be present. Thereprojection allows a lenient datum shift so that you will always get something displayed, even if themap is in slightly the wrong position. If the correct information to do the transformation is includedin the .prj file then the map will match Google's map exactly. This is often a problem with data fromOrdnance Survey, which is in OSGB36 coordinates. Adding the relevant Bursa Wolf parameters inthe '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 Ihave to create the map again?

    The resulting html file can easily be edited after creation. The title of the window and the map can bechanged in the tag in the html head at the top of the file. Further down in the main body is atable containing the map title between tags. The API key is in the html head in the tagwhere '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 tags with two tags inside. The first 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 largeshapefiles 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 wasinstalled (e.g. type 'cd C:\Program Files\CASA-UCL\GMapCreator'). Now type 'java -jargmapcreator.jar' followed by return. Load the problematic shapefile as before and any error messagesshould be visible in the command window. If the problems appear to be due to running out ofmemory then run the application with the command 'java -Xms512M -Xmx1024M -jargmapcreator.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

    Page 21 of 22GMapCreator V1.3

    16/02/2013http://www.casa.ucl.ac.uk/richard/GoogleMapCreator/Help.html

  • 7/29/2019 HelpGMapCreator Version 1.3

    22/22

    the computer then the 1024 can be increased even further. These settings have been used to loadshapefiles 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 layersover 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 nativeWindows x64 installer for. Versions for 64 bit Linux exist (AMD64), but there is no native binary forWindows and the code is not present in CVS, so cannot be compiled and built. The work around onthe JAI website is to use the pure Java version with no native acceleration. If this is installed into theclasspath then the GMapCreator will find and use it automatically. Using this method we have beenable to use the GMapCreator on a 4GB Vista x64 machine to load a 360MB shapefile. The JavaVirtual Machine under 64 bit is able to address more memory than the 32 bit one on the samemachine, 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 createthe tiles faster due to the native acceleration. If the shapefile is too large to load, then use 64 bit andaccept that creation will be slower.

    Page 22 of 22GMapCreator V1.3