[mapguide-users] Re: Creating and adding layers

Kenneth Skovhede ks at geograf.dk
Sat Jan 30 14:07:23 EST 2010

What is the "table of content" ?

Make sure you set "layer.Visible = true"
Make sure your layer is on top (IIRC, Layers.Add() places it at the bottom).
You need to call map.refresh() in javascript for the changes to appear.
I vaguely recall some issue with the legend not refreshing correctly.

Regards, Kenneth Skovhede, GEOGRAF A/S

Dejan Gregor skrev:
> Dear Kenneth,
> my colleague that has tried to apply your sample code (below) is saying that
> when adding a layer programmatically in MGOS 2.0, he does not get the table
> of content updated. Is there some special 'refresh' or some other parameter
> required somewhere to be checked?
> Thanks!
> MgResourceService srvc;
> MgMap map = new MgMap();
> map.Open(srvc, "mapname");
> MgLayer layer = new MgLayer();
> ... set layer properties, such as .LayerDefinition path ...
> map.Layers.Add(layer);
> map.Save(srvc, "mapname");
> -----
> Dejan Gregor, MSc 
> GISc Researcher and Consultant 
> http://www.linkedin.com/in/dgregor 

More information about the mapguide-users mailing list