A simple page that can be made with the JViews Maps Faces Google™ View component is to display a
Google™ Map in the page.
Creating a simple Google Maps view
<jvmf:googleView style="width:500 px; height:300 px;" level="6" lon="-100" lat="40" key="myGoogleMapKey"/>
This produces a 500 by 300 pixel view,
centered on 40°N 100°W, at a zoom level of 7.
Declaring the namespace
The namespace jvmf (for JViews
Maps Faces) must be declared in the page:
<%@ taglib uri="http://www.ilog.com/jviews/tlds/jviews-maps-faces.tld prefix="jvmf" %>
The Google View component makes use of the Google Maps API (client
side). The Google key provided in the component should contain a
valid application key in order to allow the component to display on
any server (apart from the localhost). To retrieve that key, you
need to access http://code.google.com/apis/maps/signup.html,
“Sign Up for the Google Maps API” and
register your key before using the JViews Google Maps component.
An alternative to specifying the size of the
component is to use the width and height attributes, but using the
style is preferable.
Using the Width and Height attributes
<jvmf:googleView width="500" height="300" level="6" lon="-100" lat="40" key="myGoogleMapKey"/>
Note
In some environments, for example those
that use PPR (Partial Page Refresh), you may have to register the
key in a separate statement, and not use it in the component tag
itself.
Pre-declaring the Google Maps key in
Trinidad
For example, in Trinidad:
<trh:script source="http://maps.google.com/maps?file=api&v=2&2=mykey" /> ... <tr:showDetailItem text="Background map"> <jvmf:googleView id="mapID" level="7" style="width:500px;height:300px" data="/data/world.ivl" /> </tr:showDetailItem>
The overview, zoom tool, pan tool, and interactors common component
are not compatible with this view, but are provided through the use
of Google Maps Controls. You can select the controls to display
with the
controls
attribute (see http://code.google.com/apis/maps/documentation/controls.html
).
The main use of this JSF component is to overlay JViews map layers,
symbols and links on a Google Maps background. This can be done
through the
data
attribute. In this case, the
lat
and
lon
attributes are not longer necessary - The Google map component is,
by default, centered on the JViews data.
You can also indicate that you allow the user to move the overlaid
symbols with the
nodeMovable
attribute. If this flag is set, each interaction of the user
affects the server side location of symbols, effectively modifying
their location.
Using JViews map layers and Google Maps
controls
<jvmf:googleView id="gmapID" key="some Google Maps Key" style="width:500px;height:500px" data="/data/usa.idpr" controls="GLargeMapControl,GOverviewMapControl" nodeMovable="true" level="7" />
The only other JViews component that can be
used in relation with the Google Maps view is the legend tool. This
allows the user to select which overlaid layers are visible. All
the other JViews interactors and dependent views have no effect.
Using JViews map layers tool with a Google
Maps view
<jvmf:layerTool id="layerTool" title="Google View Layers" viewId="gmapID" enabled="true" />