jMaki Map Widgets in Portlets

So you are thinking of using one of the jMaki map widgets in your portlets.  A couple of things to keep in mind:
  1. The map div may not display the way that you would like inside the portlet.  It appeared squooshed when I tried it.  But if you add another div like so, you'll get better results.

    <div style="width:100%;height:400px">
        <a:widget  name="yahoo.map"
                args="{ centerLat : 37.4041960114344,
                centerLon : -122.008194923401 }" />
    </div>
    <hr/>
    <a:widget name="yahoo.geocoder" />


    The width:100% tells the map to take up the entire width of the portlet, and the height:400px tells it to be fixed at 400 pixels high.

  2. If you use the Yahoo Geocoder widget, you will need to use the allowXDomain context parameter as I mentioned in my previous entry.
  3. Google Maps requires an API key specific to the domain that will host the portlet.  This can get hairy because of some peculiarities with jMaki and portlets.  The API key must be specified in the widget.json file for the Google Map widget (see resources/google/map).  The url in widget.json should be specified as http://host:port/context-root because jMaki will be looking up the key based on the portlet app context root.  However, the site url you specify to Google should read http://host:port/portletdriver because the map content will be served up by the portlet container.
In the end, it's probably easier to just use the Yahoo map.  You can use the Yahoo geocoder with the Google Map, but the shared API keys are already in place for the Yahoo widgets, so you don't have to do any of the key registration when you use the Yahoo map.
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

gregz

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today