Fastest way to georeference image and add it to globe

12-17-2015 04:19 AM
New Contributor


I need to create an animation from sequence of .jpg images in Globe. When new image is added, old one should be deleted. Images aren't georeferenced, but I have 4 points indicating where they should be placed.

I tried the following: 

    public partial class ArcGISHostControl : UserControl


        Dictionary<string, ILayer> _mainElementRepository;

        string workspace = "C:\\temp\\";

        IWorkspaceFactory wpf;

        IRasterWorkspace rasterworkspace;

        public ArcGISHostControl()



            _mainElementRepository = new Dictionary<string, ILayer>();

            AddBaseLayer(); //adds base maps

            wpf = new RasterWorkspaceFactory();

            raswp = wpf.OpenFromFile(workspace, 0) as IRasterWorkspace;


        private string AddNewImage(IPointCollection sourcePoints, IPointCollection targetPoints, string file, string oldID)


            string id = generateID();

            IRasterLayer layer = GeoreferenceImage(file, sourcePoints, targetPoints);

            axGlobeControl.Globe.AddLayerType(layer as ESRI.ArcGIS.Carto.ILayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, true);

            _mainElementRepository.Add(id, layer);


            return id;


        private IRasterLayer GeoreferenceImage(string file, IPointCollection sourcePoints, IPointCollection targetPoints)


            IRasterDataset2 rasterDataset;

            rasterDataset = rasterworkspace.OpenRasterDataset(file) as IRasterDataset2;

            IRasterGeometryProc rasterPropc = new RasterGeometryProcClass();

            IRaster raster = rasterDataset.CreateFullRaster();

            rasterPropc.Warp(sourcePoints, targetPoints, esriGeoTransTypeEnum.esriGeoTransProjective, raster);


            IRasterLayer layer = new RasterLayerClass();


            return layer;


        public void DeleteImage(string id)


            ILayer forDeletion;

            if (_mainElementRepository.TryGetValue(id, out forDeletion))







Problem  is that this is very slow, and causes GUI to become nonresponive.

Is there a better way to do this?

Tags (3)
0 Kudos
0 Replies