We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Replacing layers doesn't fully replace.

Thread ID:





144938 May 29,2019 12:32 PM UTC May 30,2019 01:15 PM UTC Angular - EJ 2 1
Tags: Maps
Laurens Albers
Asked On May 29, 2019 12:32 PM UTC


I have a component with maps. Within this component the user can switch between 2 layers.
So very simple, one layer needs to replace the entire existing layer. But doing that doesnt work upon initial function call, it only works upon the second (same)function call.
After the initial call, it seems that it has replaced everything except for shapeData visually -> (and yes, xxx.refresh() is being called).  I came to this conclusion because of 1st function call switching to layer2 to layer1 and then hovering over the shape. It will return errors when hovering(except for a few on the rightside) trying to find the property belonging to the shape).

I have created a stackblits for testing/replicating. -> just select the same layer twice from the dropdown.

Any idea why this is happening?



Baby Palanidurai [Syncfusion]
Replied On May 30, 2019 01:15 PM UTC

Hi Laurens, 
Greetings from Syncfusion. 
We have analysed your scenario. In your scenario, you have switched the layers by using mapLayers as object. In our source onPropertyChanged method only called for background, width and height properties of the maps and not for layers property. So, you can change the layers from maps instance like this.maps.layers and then call this.maps.refresh(). We have modified your sample and attached in below location for your reference.  
And also given the code snippet for your reference. 
Code snippet- 
  swLayer(args: any) { 
    if (args.name === "layer1") { 
      this.maps.layers = this.layer1; 
      // this.mapLayers = this.layer1; 
    else { 
      this.maps.layers = this.layer2; 
      // this.mapLayers = this.layer2; 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon