Vishful thinking…

Lack of good transparency support in Silverlight and what it means to online mapping apps

Posted in ESRI, GIS, Silverlight by viswaug on April 1, 2009

The support for transparency in PNG images in Silverlight is to say the least really bad. Here is what the Microsoft docs says about PNG transparency support in Silverlight

Silverlight does not support all possible color depths that are included in the PNG specification. The following are the PNG color depths supported in Silverlight:

  • Indexed color: 1-bit, 4-bit, or 8-bit color depth (per channel).
  • Truecolor: 24-bit color depth, or 32-bit color depth (per channel) for truecolor plus alpha.

Notably, gray scale (with or without alpha), and 64-bit truecolor, are not supported in Silverlight.

Note that they don’t mention anything about the support for 1, 2, 4 and 8 bit PNGs. This creates some problems when using the ESRI Silverlight API and you might what to keep your eye out for it and pay good attention to how your map caches are being generated. Look at the results when I overlay ArcGIS Online’s Transportation layer on top of the Imagery layer in the ESRI Silverlight maps.

<esri:Map x:Name=“MyMap” Grid.Row=“1” Grid.Column=“2”>

<esri:Map.Layers>

<esri:ArcGISTiledMapServiceLayer

ID=“StreetMapLayer”

Url=http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer&#8221;/>

<esri:ArcGISTiledMapServiceLayer

ID=“mapLayerTransportation”

Url=http://server.arcgisonline.com/ArcGIS/rest/services/Reference/ESRI_Transportation_World_2D/MapServer&#8221;/>

</esri:Map.Layers>

</esri:Map>

And here it what the map look like. As you can see, the the tile areas outside the continental US are grayed out.

Transportation3

Also, check out this Silverlight forum post where Morten schools Microsoft about the issue mentioned above.

3 Responses

Subscribe to comments with RSS.

  1. Kirk Kuykendall said, on April 1, 2009 at 3:51 pm

    I don’t understand how the VESL control can provide transparency, yet ESRI’s can’t – is microsoft hiding something?
    Look at the Add Tile Layer sample here:
    https://sharepoint.connect.microsoft.com/silverlightmapcontrolctp/iSDK/default.htm

  2. viswaug said, on April 2, 2009 at 2:54 am

    The transparency really depends on the PNG properties of the map tile images. The map tile images that show up in a dark color in the screenshot above should have PNG properties that are not supported by Silverlight.

    Vish

  3. Ian Hogan said, on April 4, 2009 at 10:12 pm

    I’m assuming then that if we have dynamic, non-cached Map Services set up in ArcGIS Server, where transparency of individual layers has been set in the MXD, we’re better off:

    1. baking our own (32bit??) caches with transparency build in, or
    2. separating out the layers that have transparency into their own Map Services, then setting individual opacity values on each one

    ?

    Ian


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: