Skip to content
Discussion options

You must be logged in to vote

You can get the map by binding to the map property or by listening to the load event. Anyway, I tried it and indeed it doesn't seem to work to update the source-layer property using setStyle.

So my recommendation would be to put Svelte's {#key} construct (https://svelte.dev/docs/logic-blocks#key) around any Layer components that need to update their sourceLayer, like this:

{#key layer}
<LineLayer
      id="lineLayerId"
     paint={{
	  'line-opacity': 0.6, 
           'line-color': 'rgb(53, 175, 109)',
	  'line-width': 2
	}}
   sourceLayer={layer}
/>
<FillLayer
	paint={{
		'fill-opacity': 0.6,
		'fill-color': 'rgb(53, 175, 109)',
	}}
	sourceLayer={layer}
  />
{/key}

This tells Svelte to t…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@dimfeld
Comment options

Comment options

You must be logged in to vote
2 replies
@dimfeld
Comment options

Answer selected by bootje
@bootje
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants