ThinkGeo.com    |     Documentation    |     Premium Support

NativeImageRasterLayer get imageExtent property issue

Hi,
I added an image by using NativeImageRasterLayer.
Code:

                    NativeImageRasterLayer rasterRadar = new NativeImageRasterLayer(imageURL, _proj.ConvertToExternalProjection(new RectangleShape(-127.6622, 50.4, -66.63, 21.56)));
                        rasterRadar.Name = "RadarLayer1";
                        ol_Radar.Layers.Add("RadarLayer1", rasterRadar);

I want to re-set ‘Image Extent’ of that Layer Extent. I tried this code. But not work out.
Code:
LayerOverlay ol = (LayerOverlay)wfMap.CustomOverlays[0];
NativeImageRasterLayer raster = (NativeImageRasterLayer)ol.Layers[0];
if (raster.Name == “RadarLayer1”)
{
NativeImageRasterSource image = (NativeImageRasterSource)raster.ImageSource;
// image. = _proj.ConvertToExternalProjection(new RectangleShape(-127.6622, 50.4, -66.63, 21.56));
}

In NativeImageRasterSource, NativeImageRasterSource property there for updating image but ‘Image Extent’ property not there.

I checked in Debug mode, that image extent property there in non-static members of NativeImageRasterSource.
Image:

Please check it, finally i want to update image extent to raster layer.

Thanks,
Riyaz

Hi Riyaz,

Render extent cannot be modify after initialize.

If you want to modify it, please build a new layer, remove original one and add the new one back.

Regards,

Ethan

Hi Ethan,
1. Remove old adding new will take some issue.
2.Actually I tried to set Projection with Image Source but it’s not works well. That’s why we are applying for Image Extent.

If we set Projection to Image Source, we can easily update projection.

Code:
layer.ImageSource.Projection=_proj;

Can you please tell me, some other way to do that.

Thanks,
Riyaz

Hi Riyaz,

We don’t have other property for change the extent, set the projection is not a good choice because if the new projection maybe reshape the image.

The sample tried remove and add back, it looks that works well.

9097.zip (778.2 KB)

Regards,

Ethan