Updating (refreshing) just 1 layer.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating (refreshing) just 1 layer.

cremebrulee
This post was updated on .
I am using MapGuide Open Source 2.2 /  fusion client viewer running on RedHat Enterprise Linux 5.
I am updating feature sources, utilizing the Java web API, and updating the concerned attribute values in my sdf files. In order for this updated sdf data to be reflected in the client viewer i do a map redraw which refreshes the map (maintaining current zoom etc) however there seems to be a flicker.  I would instead like the viewer to update just one layer (the layer that has that particular updated sdf file). However I am not able to do so and have included a snippet my javascript code. Any ideas of how i can achieve this?

var map = Fusion.getWidgetById('Map');
//map.redraw(); this is what i was using to to the complete map refresh
var mapWidget = Fusion.getWidgetById("Map").aMaps[0];
var layers = mapWidget.aLayers;
for (var i=0; i<layers.length; i++)
    {        
      var layer = layers[i];
        if (layer.layerName == 'alarms')
        {
                 <i>//layer.redraw();
                 layer.refresh(); //I have tried this two funtions calls and neither work

        }
    }
-MGnoob
Reply | Threaded
Open this post in threaded view
|

Re: Updating (refreshing) just 1 layer.

GordonL
try this.  Works for me in MapGuide:



var mapWidget = Fusion.getWidgetById("Map").aMaps[0]  
var layer = mapWidget.getLayerByName("alarms");
if (layer) {
   layer.noCache = true;
   }
mapWidget.reloadMap();
mapWidget.drawMap();

Reply | Threaded
Open this post in threaded view
|

Re: Updating (refreshing) just 1 layer.

zspitzer
as some explanation, mapguide layers are combined server side into
a single image, you can't just refresh a layer, you need to refresh the map (aka a collection of layers)


On Mon, Jun 3, 2013 at 3:02 AM, GordonL <[hidden email]> wrote:
try this.  Works for me in MapGuide:



var mapWidget = Fusion.getWidgetById("Map").aMaps[0]
var layer = mapWidget.getLayerByName("alarms");
if (layer) {
   layer.noCache = true;
   }
mapWidget.reloadMap();
mapWidget.drawMap();





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Updating-refreshing-just-1-layer-tp5050063p5057361.html
Sent from the Fusion Users mailing list archive at Nabble.com.
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
+61 405 847 168


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Reply | Threaded
Open this post in threaded view
|

Re: Updating (refreshing) just 1 layer.

cremebrulee
@zspitzer - thanks, that explanations clears up why i cannot refresh just a layer.
@GordonL - thanbks too, but that code seems to refresh the legend too in addition to the map.
-MGnoob