OIC Member Work to Share

Member Development Work

OIC Member Web Development - Projects and Tools - projects underway with Weave that may be of interest to others

Michigan Data Collaborative Demo List

http://weave.cridata.org:8787/weave-demo-list.html

Loading weave cross site and accessing the javascript API

Setup:
iframeloader.html is an html file hosted on the same server as weave, it is just an html page that loads weave with a session state.

test.html is loading iframeloader.html as an iframe. Test.html has a button that is used for the click event trigger.

Both have jquery loaded, and also the script from here:
http://benalman.com/projects/jquery-postmessage-plugin/

on iframeloader.html the javascript:

$.receiveMessage(
           function(e){
               eval(e.data);
            },
             'http://originatingSiteUrl.com'
);

http://originatingSiteUrl.com will be the domain name that hosts test.html.

Basically takes whatever is sent to it and evals as javascript.

on test.html:

$("#buttonId").click(function(){
        var i = 'var aaa = document.getElementById("weave").getSessionState(["MapTool", "children", "visualization", "zoomBounds"]);';
        var ii = 'console.log(aaa)';
        $.postMessage(
                  i + ii,
                  'http://path.to/iframloader.html',
                  frame
                );
    });

in the postmessage function, the first parameter is the "message" to send, the second is the location of the html file, and the third is the id of the iframe, in this case "frame".

This sends javascript as a string, and the receiver evals it and it works.

Working With R

OIC Members working with the R statistical package (http://www.r-project.org/) include Columbus, Atlanta, and Seattle.

Please add any specific tips/experience here that would help others get started

Need to identify what computational support might be needed

Gallery Feature - CT

CT has developed a feature to save a Weave instance to a gallery by taking a snapshot of its session state and allowing a registered user to either store it in their private gallery or share it in a public or defined group gallery.

For now, one can add a TITLE and a brief description. We are looking to add the ability to add a longer description, to rate the visualization, and tag it.

Contact: Eudald Lerga

Community profiles

Grand Rapids and Providence both have thorough Community Profiles tools they are willing to share

See Grand Rapids' tool at http://www.cridata.org/GeoProfile.aspx?type=16&loc=2634000

Proxy Weave web services

MAPC is serving all Weave related server requests on port 80, the standard HTTP port. The default Weave web service port, usually 8080 (on Tomcat for instance), bears the risk of being blocked by some corporate firewalls, which would make Weave inaccessible to some users. A solution is to proxy the Weave web service port to the standard HTTP port 80.

MAPC is using Nginx, a fast evented web server, to proxy Weave web services and serve all Weave related static files, which is also faster and more efficient than using Tomcat for the same task.

Our Nginx configuration also gives us better security by restricting access to the AdminConsole to a specified IP address range for instance. In addition we set expiration headers on all Weave client files and have more control when those are being refreshed on our users computers. That hopefully eliminates the problem for some users, when outdated Weave client files are loaded from a user's local disk cache instead of our server.

Below is an example of our web server configuration. Other server configurations (e.g. for Apache HTTP or Microsoft IIS) might follow similar approaches, but will use a different configuration syntax.

server {

    listen   80;
    server_name myweavedomain.org;

    # url where Weave client files are being accessed
    location /weave/ {
        # directory for weave client (static) files, like *.swf, *.css, *.html, etc.
        root   /var/www/weave/public/;
        index  index.html;
        # expiration http header for weave client files
        expires 1d;
    }

    # access rules for the AdminConsole
    location ~ ^(/weave/AdminConsole\.html|/weave/AdminConsole\.swf)$ {
        root   /var/www/weave/public/;
        # restrict to IP address range
        allow 0.0.0.0/24;
        deny all;
        # set http expiration header
        expires 1d;
    }

    # proxy Weave web services on local Tomcat server
    location /WeaveServices/ {
        proxy_pass              http://127.0.0.1:8080/WeaveServices/;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        Host $http_host;
    }

}