[mapguide-users] Help regarding to set filter for a layer programmatically using Java

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Wed Jul 29 03:31:08 EDT 2009


There are only few examples of Java code avalible.

These are the steps to perform, regardless of programming language:

1) Obtain the LayerDefinition xml
2) Update the <Filter> tag
3) Save the LayerDefinition to a temp name (in the Session repository)
4) Get a reference to the Runtime map (MgMap.Open)
5) Update the runtime map's layer to point to the temp resource created 
in (3)
6) Save the runtime map
7) Refresh the client


If you want to modify the layer filter BEFORE the viewer loads, you need 
to do this:

1) Obtain the LayerDefinition xml
2) Update the <Filter> tag
3) Save the LayerDefinition to a temp name (in the Session repository)
4) Obtain the MapDefinition.xml
5) Update the MapDefinition's layer to point to the temp resource 
created in (3)
6) Save the MapDefinition to a temp name (in the Session repository)
7) Obtain the WebLayout/ApplicationDefinition xml
8) Update the Map/ResourceId to point to the temp resource created in (6)
9) Save the WebLayout/ApplicationDefinition to a temp name (in the 
Session repository)
10) Open the viewer and point to the temp resource created in (9)

If any of the steps cause you trouble, ask again.

Regards, Kenneth Skovhede, GEOGRAF A/S



Jai Prakash Mansukhani skrev:
> Hi all,
> I have a map with a layer that is being populated from x/y coordinates
> from an MySQL server table and want to be able to dynamically add a
> filter to the layer. i.e. filter the data based on who is logged in.
>
> I read a few post on this topic before but i was not able to 
> understand the concept with satisfactory.
>
> It would very kind of you if somebody can provide me with some piece 
> of code.
>
> Thanks and Regards,
> Jai Mansukhani
>
>
>
> _______________________________________________
> 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