[mapguide-users] Adding OpenLayers.Layer to Fusion Map
Mark Pendergraft
markp at Meadgilman.com
Wed Jan 7 15:27:32 EST 2009
I would like to add an OpenLayers.Layer (specifically google maps) to my
MGOS Fusion Layout. I've been looking through the posts and there is a
lot of info regarding both of these but I'm at a loss as to how to
implement it with Fusion.
I can get the OpenLayers map using the following code
var mapWidget = Fusion.getWidgetById('Map');
var olmap = mapWidget.oMapOL;
and on a separate page that I made I can implement google into
openlayers using the following script:
map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 20}
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: G_HYBRID_MAP, numZoomLevels: 20}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: G_SATELLITE_MAP, numZoomLevels: 20}
);
map.addLayers([gphy, gmap, ghyb, gsat]);
map.setCenter(new OpenLayers.LonLat(10.2, 48.9), 5);
But I'm not sure how to implement both together. When I add the google
layers to the olMap, nothing breaks but my normal Fusion layout shows
up.
I'm looking for a push in the right direction here, or a link to an
example that I can explore. The end goal is to have my normal Fusion
map with google as a layer which can be turned on/off in the legend
widget.
I'm assuming that I will have to access openlayers via
Fusion.getWidgetById('Map').olMap; and add the openlayers.layer to the
olMap. But then how do I register those layers with the mapWidget in
order for them to show up. Also, I'm assuming that I will have to set
some type of bounds or coordinate conversion for the google layers to
know where they are on my map, seeing as my map is on a state plane
coordinate system instead of lat/long.
Thanks for the help
-Mark P.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090107/c13e8879/attachment.html
More information about the mapguide-users
mailing list