Select to view content in your preferred language

Mosaic Dataset - Don't Mosaic Transparent Pixels?

5785
6
05-10-2013 08:44 AM
JasonGreenlaw
Regular Contributor
I have a mosaic dataset that stores two regional single-band (grayscale) images. 

In one of the images, there are areas where the pixel value is zero.  I don't want to display these pixels, so I have tried both 1) setting the NoData value of the Mosaic Dataset to 0 (and displaying NoData as transparent), and 2) selecting "Display background value [0] as [transparent]".  Both methods properly set the pixels to transparent, but unfortunately, these transparent areas overlap my second image, obscuring it. 

I have enabled time on the mosaic dataset, set the default mosaic operator to "FIRST" and configured it to sort in descending order of the time field (i.e., more recent images have higher priority).  So, whenever the first regional image (with the transparent areas) is the newest image, it is mosaicked over the second image, which obscures the second image's pixels, even when the higher-priority image's pixels are NoData/transparent.

Does anyone have a suggestion as to how to resolve this?  I realize I could clip the first image, but would prefer to avoid that.  Is my only other option to configure my mosaic operator/sort order to always prefer the second image, or is there a way to avoid mosaicking transparent pixels?

Thanks,
Jason
0 Kudos
6 Replies
MelanieHarlow
Esri Contributor
You can insert the MASK function on the item in the mosaic dataset where you need to define NoData, and not on the mosaic dataset.

  1. Add the mosaic dataset to ArcMap.

  2. Open the Attribute table.

  3. Click the little arrow that appears next to <Raster> in the Raster field for that item and on the Functions tab insert the Mask function and set the parameters.

0 Kudos
RobertBorchert
Honored Contributor
Mask function is the good option.

Those areas are still part of the raster even if they have no value.  I would be good if there was a compact function for rasters would compress out those null value areas.  Another option if you have a good photo editor is to cut the image and delete out those null areas.  However, this will probably result in a feathered edge.

I have a mosaic dataset that stores two regional single-band (grayscale) images. 

In one of the images, there are areas where the pixel value is zero.  I don't want to display these pixels, so I have tried both 1) setting the NoData value of the Mosaic Dataset to 0 (and displaying NoData as transparent), and 2) selecting "Display background value [0] as [transparent]".  Both methods properly set the pixels to transparent, but unfortunately, these transparent areas overlap my second image, obscuring it. 

I have enabled time on the mosaic dataset, set the default mosaic operator to "FIRST" and configured it to sort in descending order of the time field (i.e., more recent images have higher priority).  So, whenever the first regional image (with the transparent areas) is the newest image, it is mosaicked over the second image, which obscures the second image's pixels, even when the higher-priority image's pixels are NoData/transparent.

Does anyone have a suggestion as to how to resolve this?  I realize I could clip the first image, but would prefer to avoid that.  Is my only other option to configure my mosaic operator/sort order to always prefer the second image, or is there a way to avoid mosaicking transparent pixels?

Thanks,
Jason
0 Kudos
JasonGreenlaw
Regular Contributor
Thanks for the suggestion.  One thing I forgot to mention, though, is that this all has to be automated.

This mosaic dataset will be updated several times per hour with new versions of each regional image, and I will be maintaining about 3 hours of imagery at any one time.  Each time I import a new raster, I would have to apply the mask, correct? 

Is there an ArcPy function I can execute to mask an individual Mosaic Dataset item?

Thanks for the help,
Jason
0 Kudos
RobertBorchert
Honored Contributor
All I have to say is wow!

Automating a  raster mosaic to run several times an hour.  It should be possible  but  i would think would be hard on resources.

Thanks for the suggestion.  One thing I forgot to mention, though, is that this all has to be automated.

This mosaic dataset will be updated several times per hour with new versions of each regional image, and I will be maintaining about 3 hours of imagery at any one time.  Each time I import a new raster, I would have to apply the mask, correct? 

Is there an ArcPy function I can execute to mask an individual Mosaic Dataset item?

Thanks for the help,
Jason
0 Kudos
JasonGreenlaw
Regular Contributor
Actually not too bad on resources.  All I have to do is a little reprojection and add rasters to/remove rasters from the mosaic dataset along with some SQL magic.  I have several other similar routines running even more frequently (every 5 minutes), and so far everything seems to work pretty well.  The code is running on a beefy Linux ArcGIS Server machine.

I did some more searching but it does not sound like it's possible to automate calling the Mask function via ArcPy (correct me if I'm wrong), so I believe I am left with two options:

1) Crop the image to remove the transparent regions, or
2) Add a "Best" field to the mosaic dataset (which I will have to populate/update manually based on validtime and region) and use that as the default mosaic sorting operation.
0 Kudos
AbhijitDoshi
Esri Contributor
Use Edit raster function GP tool to add the mask function on a Item, you can make a selection my making a mosaic layer and then applying the function on it. You will need to save mask function in raster function template ( arcGIS 10.1)

http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000163000000

Regards

Abhijit
0 Kudos