[mapguide-users] Fusion API, how to add new vector layer (OpenLayers)

Бородаев Павел Владимирович paul at cic.volgadmin.ru
Thu Mar 27 11:01:58 EDT 2008


I tried to add vector layer to olMap (in many different places of code), of course! But this make fusion example non-working (no map loading, no items in legend window (only root node)). Seems that some part of code need to be corrected to deal with new type of OL layer, which is not MapServer Layer

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Paul Spencer
Sent: Thursday, March 27, 2008 3:07 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] Fusion API,how to add new vector layer (OpenLayers)

I would like to expose the OpenLayers API directly in Fusion but that  
isn't done yet.  You can get to the OpenLayers Map object by doing  
something like:

//'Map' is the HTML container for the map, set in MapWidget tag of  
ApplicationDefinition
var fusionMapWidget = Fusion.getWidgetById('Map');
var olMap = fusionMapWidget.olMap;

Then you can do whatever you want with olMap.  Note that the  
OpenLayers included with MapGuide Fusion may not be a full build of  
OpenLayers so stuff like Vector might be missing - you may be able to  
replace Fusion's OpenLayers.js with one that you build yourself.

Cheers

Paul

On 27-Mar-08, at 5:14 AM, Kenneth, GEOGRAF A/S wrote:
> If you use OpenLayers from scratch, you will need a version with  
> MapGuide support.
> I'm not sure if the 2.5 release has that, but the SVN trunk has.
>
> To add a vector layer you can do:
> var map = new OpenLayers.Map(...);
> var mgLayer = new OpenLayers.Layer.MapGuide(...);
> var vectorLayer = new OpenLayers.Layer.Vector(...);
> map.addLayer(mglayer);
> map.addLayer(vectorLayer);
>
> You will need to check up on the OpenLayers API for data to put in  
> the ... places.
>
> The same should work in Fusion, you just have to find the name of  
> the map variable.
>
> Regards, Kenneth, GEOGRAF A/S
>
>
> Бородаев Павел Владимирович skrev:
>>
>> Hi All.
>> Is it possible to add new vector layer or other layers to web map  
>> using OpenLayers API?
>> What modifications of source code I should do and where? This will  
>> be very useful for me: if it is impossible I will use OpenLayers  
>> from scratch.
>> TIA.
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users

_______________________________________________
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