Step 0: Installing G-language Genome Analysis Environment

Download and install G-language Genome Analysis Environment v.1.8.3 or above following the instructions in: http://www.g-language.org/wiki/software

Step 1: Creating custom zoomable map from your image

In your shell, type G to startup G-language Shell. For details about G-language Shell, see here.

Then type generateGMap(“yourImageFile.png”). Image can be in any format supported by ImageMagick utility (therefore virtually every possible format). This step takes up to 10~15 minutes depending on the performance of your computer, so please be patient. After this process a folder named “yourImageFile” is created in your working directory.

That's it! Now type quit and answer n to quit G-language Shell.

% G

	     __/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/
                
                   G-language  Genome Analysis Environment v.1.8.3

 
                             http://www.g-language.org/

              Please cite: 
                 Arakawa K. et al. (2003) Bioinformatics.
                 Arakawa K. et al. (2006) Journal of Pestice Science.

 	      License: GNU General Public License
	      Copyright (C) 2001-2008 G-language Project
	      Institute for Advanced Biosciences, Keio University, JAPAN 

	     __/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/__/
	   
G > generateGMap("yourImageFile.png", -level=>2)
Google Map View is generated in yourImageFile directory.

G > quit
  save value ?  y/n (or cancel) ?
quit >>n
% 

In the newly created folder named “yourImageFile” (without the extension), find a file named “index.html”, and open this file with your favorite browser (usually double clicking on the file does the job). Now enjoy zooming into your favorite image!

Step 2: Customizing the zoom level

By default, the maximum zoom level is set to 6, which is 8192×8192 pixels. This zoom level can be changed by supplying -level⇒ option to generateGMap, as follows:

G > generageGMap("yourImageFile.png", -level=>4)

The image size is 2^(level - 1) * 256. Note that generation of very large image takes a lot of disk space and memory. Level 7 usually requires around 4GB of RAM, so the default level should be sufficient in most cases.

You can browse the documentation for generateGMap by typing

G > help generateGMap

in G-language Shell.

G > help generateGMap

  Name: generateGMap   -   generate Google Map View from given image file

  Description:
    This method generates a zoomable AJAX viewer interface for the
    given image, by splitting the image and generating the HTML page,
    using Google Maps API v.2. Open the "index.html" file with your
    browser when the directory containing split images and the HTML
    is generated. 

    Note that it will take a very long time to generate images 
    with levels greater than 6. 

  Usage: 
    generateGMap("imageFileName.png");
    Here the image format can be anything supported by ImageMagick.
    For best viewing experience, square image is preferred.

    When you wish to make the generated map public, obtain a Google
    Map API Key from 
       http://www.google.com/apis/maps/signup.html
    and replace the string "YOUR_GOOGLE_MAP_KEY_HERE" within the
    generated HTML. 

  Options:
    -level     maximum zoom level. (default: 6)
              This value should be larger than 3.
              Image width size is 2^(level - 1) * 256, so width at
              level = 6 is 8192. 

  References:
    1. Google Maps API Documentation. http://www.google.com/apis/maps/documentation/

  Author: 
    Kazuharu Arakawa (gaou@sfc.keio.ac.jp)

  History:
    20070707-01 stopped tiling in the x-direction by default
    20070621-01 initial posting

Step 3: Publishing your zoomable map on your web server

To publish the generated map, you need to place the generated folder in your webserver (usually in public_html folder or /var/www/html/), and then change the Google Maps Key.

First, go to Google Code Website for Google Maps API and obtain a Google Map Key for your website.

Then, open the index.html of your generated map with your favorite text editor, and edit the first <script> tag where it reads “YOUR_GOOGLE_MAP_KEY_HERE”, replacing it with the obtained key.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
                   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">    
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>Google Map View of NC_000913 - generated by G-language GAE</title>
 
    <script src="http://maps.google.com/maps?file=api&v=2.x&key=YOUR_GOOGLE_MAP_KEY_HERE"
            type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
generating_custom_zoomable_maps_from_any_image_file.txt · Last modified: 2009/04/19 15:41 (external edit)