[mapguide-users] Re: Viewer API GetLayer() and base layers

prbabu prbabu at openspatial.com.au
Sun Apr 18 20:37:47 EDT 2010

Hi Tom,
     Elaborating on my earlier post of implementing the "GetLayer()" as a
WebAPI method. The way I have done it is, using jQuery AJAX to make a call
to the back-end code(C#/PHP...). 

Steps to do:
(1)  Have a quick understanding of making AJAX calls(if not). For jQuery you
can follow the link -  

(2) The back-end code logic would be something like the below
      (a) Do all the basic stuff, like opening the map of the current
session map
      (b) Get the layer collection - MgLayerCollection layerColln =
      (c) Loop through each of the object in the layer collection and get
the MgLayer object:
               MgLayer layer = layerColln.GetItem(i) as MgLayer;
      (d) Lastly check if the layer is visible like:
           if (layer.IsVisible())
                    // Add it to your collection....
      (e) Send it back to the web-browser as JSON(which is a way to send
           back when making a AJAX request)

The above is just a code flow, as I want to mention more on the logic,
rather than a
specific code implementation. Please try and let us know if you have any


View this message in context: http://n2.nabble.com/Viewer-API-GetLayer-and-base-layers-tp4792901p4922884.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

More information about the mapguide-users mailing list