<div dir="ltr"><div>Thanks for the sortshp tip!  You are correct -- sorting the tileindex yields the result I expected.<br></div><div><br></div><div>If the black pixels cover the full extents of black.tif (ie. with zero NODATA values), then Mapserver will render either an all black or an all gray image, regardless of the sorting order in the non-overlapping geometries in the tileindex.  When I internally tile the source images and zoom in, Mapserver does something curious: If the intersection between the tileindex and the requested bbox contain a single record, Mapserver will render the correct image.  When I zoom in, Mapserver renders an aliased image on the 256x256 WMS requests sent by the client.  I would guess the requested BBOX is intersected with the tileindex.  When the intersection yields a single item in tileindex, it renders the correct image.  When there are two items in the intersection of the requested BBOX and tileindex, the images are painted over the full requested BBOX in the order provided by the tileindex.</div><div><br></div><div>I also could not find any docs/requirements on a tileindex guaranteeing ordering of the stacking images returned by the tileindex... so I guess it's best to not rely on this and just burn in NODATA/an external mask to my source images if I need such behavior.</div><div><br></div><div>Thanks again,</div><div>Pete</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 19, 2017 at 4:31 AM, thomas bonfort <span dir="ltr"><<a href="mailto:thomas.bonfort@gmail.com" target="_blank">thomas.bonfort@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Peter, if I understand correctly....<div>I'm not aware that there is any documentation or requirement that using a tileindex with mapserver garantees any ordering in the stacking of the images returned by the tileindex. Namely, if your tileindex returns your gray (opaque) image after (i.e. on top of) your black/white image, then your black/white image will be completely obscured by your gray image.</div><div>This is what I'd try:</div><div>- try using the sortshp utility on your tileindex (once in ascending order, once in descending) and see if the resulting image is affected</div><div>- use a postgis based tileindex layer with explicit ORDER BY clauses to enforce that transparent images get rendered after opaque ones</div><div><br></div><div>--</div><div>thomas</div></div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Thu, Jan 19, 2017 at 12:31 AM Peter Schmitt <<a href="mailto:pschmitt@gmail.com" target="_blank">pschmitt@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr" class="m_4134350825859803187gmail_msg">Hi,<div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg">I have a tile index to render a layer from two images.  The images are black.png  <a href="https://github.com/pedros007/mapserver-tindex-problem/blob/master/black.png?raw=true" class="m_4134350825859803187gmail_msg" target="_blank">https://github.com/pedros007/<wbr>mapserver-tindex-problem/blob/<wbr>master/black.png?raw=true</a> which has NODATA values over the white areas and grayscale pixels with intensity 1 and gray.png with intensity 128 and zero NODATA values in the image <a href="https://github.com/pedros007/mapserver-tindex-problem/blob/master/gray.png?raw=true" class="m_4134350825859803187gmail_msg" target="_blank">https://github.com/pedros007/<wbr>mapserver-tindex-problem/blob/<wbr>master/gray.png?raw=true</a></div><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg">I have a tileindex <a href="http://bl.ocks.org/d/968e0f11f1fd9b02444c3765bbb285a1" class="m_4134350825859803187gmail_msg" target="_blank">http://bl.ocks.org/<wbr>d/<wbr>968e0f11f1fd9b02444c3765bbb285<wbr>a1</a> that basically stacks/flattens the black image on top of the gray one.  However, when I make a WMS request to the layer:</div><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg"><div class="m_4134350825859803187gmail_msg">LAYER</div><div class="m_4134350825859803187gmail_msg">        NAME my_layer</div><div class="m_4134350825859803187gmail_msg">        TYPE RASTER</div><div class="m_4134350825859803187gmail_msg">        TILEINDEX tindex.shp</div><div class="m_4134350825859803187gmail_msg">        TILEITEM "location"</div><div class="m_4134350825859803187gmail_msg">        OFFSITE 0 0 0</div><div class="m_4134350825859803187gmail_msg">        STATUS OFF</div><div class="m_4134350825859803187gmail_msg">    END</div><div class="m_4134350825859803187gmail_msg">END</div></div><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg">I get only the gray image.  In other words, I expected to get this:</div><div class="m_4134350825859803187gmail_msg"><a href="https://github.com/pedros007/mapserver-tindex-problem/blob/master/expected.png?raw=true" class="m_4134350825859803187gmail_msg" target="_blank">https://github.com/pedros007/<wbr>mapserver-tindex-problem/blob/<wbr>master/expected.png?raw=true</a><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg">but instead I get this: </div><div class="m_4134350825859803187gmail_msg"><a href="https://github.com/pedros007/mapserver-tindex-problem/blob/master/gray.png?raw=true" class="m_4134350825859803187gmail_msg" target="_blank">https://github.com/pedros007/<wbr>mapserver-tindex-problem/blob/<wbr>master/gray.png?raw=true</a></div><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg"><div class="m_4134350825859803187gmail_msg">I have a couple of work-arounds that I'm not crazy about:</div><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg">1. Add Layer masks <a href="http://www.mapserver.org/development/rfc/ms-rfc-79.html" class="m_4134350825859803187gmail_msg" target="_blank">http://www.mapserver.org/<wbr>development/rfc/ms-rfc-79.html</a><wbr> to two separate layers, make two WMS requests and stack the results client side. I have gotten this working for two layers. However, I may need to render a very large number of such layers and think this wont work client-side (via OpenLayers-3).</div><div class="m_4134350825859803187gmail_msg">2. I could burn in NODATA values (or use a mask) to gray.tif, but I'd rather not modify my source data.</div></div><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div><div class="m_4134350825859803187gmail_msg">A version of this email & example files are in a GitHub repo: <a href="https://github.com/pedros007/mapserver-tindex-problem" class="m_4134350825859803187gmail_msg" target="_blank">https://github.com/<wbr>pedros007/mapserver-tindex-<wbr>problem</a></div><div class="m_4134350825859803187gmail_msg"><div class="m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div>-- <br class="m_4134350825859803187gmail_msg"><div class="m_4134350825859803187m_4277929752198678022gmail_signature m_4134350825859803187gmail_msg">Pete</div><div class="m_4134350825859803187m_4277929752198678022gmail_signature m_4134350825859803187gmail_msg"><br class="m_4134350825859803187gmail_msg"></div>
</div></div></div></div>
______________________________<wbr>_________________<br class="m_4134350825859803187gmail_msg">
mapserver-users mailing list<br class="m_4134350825859803187gmail_msg">
<a href="mailto:mapserver-users@lists.osgeo.org" class="m_4134350825859803187gmail_msg" target="_blank">mapserver-users@lists.osgeo.<wbr>org</a><br class="m_4134350825859803187gmail_msg">
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" class="m_4134350825859803187gmail_msg" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/mapserver-<wbr>users</a></blockquote></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Pete</div>
</div></div>