[mapguide-users] Re: Add Mapguide layer to OpenLayers

Michael Adair madair at dmsolutions.ca
Mon Oct 3 13:33:21 EDT 2011


For untiled layers you can specify a mapName and session, or else a 
mapDefinition and locale.  See 
http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/MapGuide-js.html#OpenLayers.Layer.MapGuide.OpenLayers.Layer.MapGuide 
for more guidance.

Mike

On 03/10/2011 12:41 PM, Greg wrote:
> OK.  I think I understand what you are saying about the name.  For some
> reason, though, while I am able to create a mapguide base layer like this:
>
>      var params = {
>          mapdefinition: "Library://maps/Cid_Map_Flex.MapDefinition",
>          selectioncolor: "0xFF000000",
>          behavior: 7
>      };
>
>      var options = {
>          isBaseLayer: true,
>          transitionEffect: "resize",
>          buffer: 1,
>          useOverlay: false,
>          useAsyncOverlay: false,
>          singleTile: true,
>          maxExtent: extent,
>          maxResolution: 'auto',
>          numZoomLevels: 20,
>          sphericalMercator: true
>      };
>
>      var myBaseLayer = new OpenLayers.Layer.MapGuide("Cid_Map", url, params,
> options);
>      map.addLayer(myBaseLayer);
>
> I am unable to do it like this:
>
>      var params = {
>          mapname: "'" + mapName + "'",
>          session: "'" + sessionId + "'",
>          selectioncolor: "0xFF000000",
>          behavior: 7
>      };
>
> The mapName and sessionId parameters passed to the function appear to be
> correct but my browser is giving the following error:
>
> "Failed to load resource: the server responded with a status of 559
> (MgConnectionFailedException)"
>
> the url looks like this:
>
> /mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous&mapname='Cid_Map_for_OL'&session='fe95b18c-edda-11e0-8000-485b394503be_en_7F0000010AFC0AFB0AFA'&selectioncolor=0xFF000000&behavior=7&
> ...
>
> I think that OpenLayers is finding my map but the mapguide server won't
> allow the connection the way I have supplied the parameters.  Is there
> anything I am missing?
>
> I would just use the first method but what I really want to do is use the
> Mapguide layer as an overlay and use Google maps as my base layer.
> According to the documentation, the only way to add a Mapguide layer as an
> overlay is using the mapname and sessionid.  When I try it the other way I
> get "MgInvalideArgumentException"
>
>
>
>
>
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/Add-Mapguide-layer-to-OpenLayers-tp6841213p6855662.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list