Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undesired white background being added to dynamicMapLayer #1187

Closed
teofilosalgado opened this issue Mar 17, 2020 · 12 comments
Closed

Undesired white background being added to dynamicMapLayer #1187

teofilosalgado opened this issue Mar 17, 2020 · 12 comments

Comments

@teofilosalgado
Copy link

  • Browser and version:

All supported browsers;

  • Version of Leaflet (L.version):

1.6.0

  • Version of esri Leaflet (L.esri.VERSION):

2.3.3

Steps to reproduce the error:

  1. Add a dynamicMapLayer to a leaflet map with the following code:
this.mapServer = esri.dynamicMapLayer({
        f: 'image',
        url: URL_MAPSERVER,
        transparent: true,
        maxZoom: DEFAULT_CONFIG.maxZoom,
        minZoom: DEFAULT_CONFIG.minZoom,
        layers: [0, 1, 2, 3, 4, 5]
      })

What happens is: every layer my ArcGIS MapServer provides are rendered with an opaque white background layer below them.
Captura de tela de 2020-03-17 11-55-46

According to Firefox's network tab in developer options, the image returned by the ArcGIS service for the aforementioned screenshot is:
export

I was expecting: esri-leaflet to render my layers just like AGOL does.
Captura de tela de 2020-03-17 12-15-54

@gavinr
Copy link
Contributor

gavinr commented Mar 17, 2020

@teofilosalgado can you please share the URL to the mapservice you are using?

@jwasilgeo
Copy link
Contributor

@teofilosalgado also what format is being used? Default of esri-leaflet should be 'png24' but the white background makes me wonder if a 'jpg' format is being used.

@jwasilgeo
Copy link
Contributor

And a demo to help us debug would speak 1,000 words, too.

(if possible, create a jsbin that demonstrates the problem)

@teofilosalgado
Copy link
Author

@teofilosalgado
Copy link
Author

teofilosalgado commented Mar 17, 2020

@jwasilgeo I left format to the default settings, as you said, 'png24'.
The snippet below could reproduce the problem in any enviroment, it's quite simple:

const map = L.map('map', this.config)
const mapServer = esri.dynamicMapLayer({
        f: 'image',
        url: 'http://sistemas.gt4w.com.br/arcgis/rest/services/SICARF/Camadas/MapServer',
        transparent: true,
        maxZoom: 16,
        minZoom: 3,
        layers: [6]
})
mapServer.addTo(map)

I will create an JSBin and reply it's link here ASAP.

@teofilosalgado
Copy link
Author

teofilosalgado commented Mar 17, 2020

@jwasilgeo
Copy link
Contributor

@teofilosalgado thank you for the extra info and for the jsbin.

Can you try also this property in your layer options?

format: 'png32'

I think that works better and seems to provide the visual output you want. Must just be png24 vs png32.

@teofilosalgado
Copy link
Author

@jwasilgeo it worked like a charm! Thank you! Me and my team were stuck with this problem for days!

@jwasilgeo
Copy link
Contributor

I'm very happy to hear the good news. Do you happen to have any feedback or suggestions on improvements to the documentation, such as for the format option?

@jgravois
Copy link
Contributor

would it help to just default to "png32" 🤷‍♂

@teofilosalgado
Copy link
Author

teofilosalgado commented Mar 17, 2020

I agree with @jgravois, I really thought png24 could handle transparency without any problems. We are used to correlate png (in any flavor of it's specification) with transparent images. Maybe adding a note on png32/png24 in the documentation would be helpful, or even explaining why this happens.

pmacMaps added a commit to pmacMaps/esri-leaflet that referenced this issue Jun 8, 2020
Change all references to 'png24' in the Dynamic Map Layer Spec to 'png32'

Related to Esri#1187.
@jwasilgeo
Copy link
Contributor

jwasilgeo commented Jun 8, 2020

L.esri.dynamicMapLayer now defaults to png32 for the format parameter. Thank you @pmacMaps. See PR #1202.

jgravois pushed a commit to jgravois/esri-leaflet that referenced this issue Apr 23, 2022
Change all references to 'png24' in the Dynamic Map Layer Spec to 'png32'

Related to Esri#1187.
jgravois pushed a commit to jgravois/esri-leaflet that referenced this issue Apr 23, 2022
Change all references to 'png24' in the Dynamic Map Layer Spec to 'png32'

Related to Esri#1187.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants