script to create map with clickable links

From: Joe Grim <grim_at_nyahnyahspammersnyahnyah>
Date: Sun Jul 31 2011 - 13:42:21 MDT



I have created a script to create a map with clickable web links for my
personal weather website. Since I have never found anything like this on
the NCL webpage or on ncl-talk, I thought I would post how I did it, in case
anyone else ever wants to do the same thing.


Before I provide the script, here are the main steps I used in the script:

1) Created a map plot of the USA using gsn_csm_map

a. The map uses CylindricalEquidistant projection and is scaled using
vpWidthF and vpHeightF so that the shape of the states is nearly the same as

2) Cropped the map plot to only show the map using ImageMagick's
"convert" command

a. All Titles, exterior tickmarks and anything else outside the map
was not plotted so that it would easily crop to only the map

3) Determined the dimensions of the cropped map plot using the Linux
"file" command

4) Obtained latitude and longitude data of all states' boundaries

a. Used a very coarse data set so as to not have too many points

5) Converted the latitude and longitude data from the state boundaries
to pixel locations within the map plot

6) Created the webpage using the x/y state boundary pairs for the links
to each state


The webpage itself is at:

The main script is located at:

The state boundary data is located at:

The static HTML code used for the webpage is at:*.asc where * is either "_start"
or "_end".


In order to modify this for your own purposes, you would have to know HTML,
but it should be relatively easy to follow my example. I have also used a
more complicated version of this script to create the individual webpages
for each state.


The whole suite of recently-added NCL string functions helped make this much
easier than it would be otherwise. I also realize that there are probably
easier programs than NCL to create a webpage like mine, but since I know NCL
best, it is the tool I used. Thank you to everyone who has made NCL so




Joe Grim

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Sun Jul 31 13:42:32 2011

This archive was generated by hypermail 2.1.8 : Wed Sep 07 2011 - 10:58:58 MDT