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

Paul Spencer pagameba at gmail.com
Thu Mar 27 08:06:32 EDT 2008


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



More information about the mapguide-users mailing list