Select to view content in your preferred language

AGSRasterLayer with AGSImageServiceRaster: Renderer for removing NoDataValues

479
2
10-26-2021 07:07 AM
wuep
by
New Contributor II

I tried to reduced the black part of my raster layer. Unfortunately with no success. Has any one a better idea on how to do that?

 

        let url = "https://gis.lsfm.zhaw.ch/server/rest/services/Basis-Inhalte/orthophoto_gruental_3857_png/ImageServer"

        let imageServiceURL = URL(string: url)!
        
        // create an image service raster from an online raster service
        let imageServiceRaster = AGSImageServiceRaster(url: imageServiceURL)
        self.rasterLayer = AGSRasterLayer(raster: imageServiceRaster)
        let blendRenderer = AGSBlendRenderer (
            elevationRaster: AGSRaster(),
            outputMinValues: [],
            outputMaxValues: [],
            sourceMinValues: [],
            sourceMaxValues: [],
            noDataValues: [255],
            gammas: [100],
            colorRamp: AGSColorRamp(type: AGSPresetColorRampType.demScreen, size: 100),
            altitude: 0,
            azimuth: 0,
            zFactor: 1,
            slopeType: AGSSlopeType.none,
            pixelSizeFactor: 1,
            pixelSizePower: 1,
            outputBitDepth: 8)
        
        self.rasterLayer.renderer = blendRenderer
        map.operationalLayers.add(self.rasterLayer!)
        mapView.map?.backgroundColor = UIColor .clear
        
         self.rasterLayer.load { [weak self] (error) in
            if let error = error {
                print("error: \(error)")
            } else {
                if let center = self?.rasterLayer.fullExtent?.center {
                    self?.mapView.setViewpoint(AGSViewpoint(center: center, scale: 8000))
                }
            }
         }

 

 

Picture.png

0 Kudos
2 Replies
AngelaGray
New Contributor III

Hello,

I'm still learning and banging around trying to learn how to use Image server for multi temporal data layers.

I'm utilizing/trying to follow the Mosaic Dataset workflow documentation (which may be different from your workflow), I THINK that building the footprint has taken care of this issue for me? When you build the footprint, you can choose to build it based on Radiometry so therefore exclude No Data areas. 

Again, I'm new and still don't fully grasp the nuances. 

Good luck!!

 

wuep
by
New Contributor II

Thanks for your helpful and precious input. I will try that and post results.

0 Kudos