Raster layer spatial reference "on the fly" bug

53
0
a week ago
Highlighted
New Contributor II

I'm creating .jpg.aux.xml and .jgw files "on the fly", before i create them i check if the raster already has extent and spatial reference by creating Raster object and raster layer and checking if it has spatial reference.

Raster raster = new Raster(JpgFilePath);
            RasterLayer rl = new RasterLayer(raster);
            await rl.LoadAsync();
            if (rl.SpatialReference != null)
            {
            }

 

if the file has no spatial reference i create the jpg.aux.xml and jgw files.

afterwards i check again if it has spatial reference, and its still null.

only after i restart the program and run it when the file already exists, it has the spatial reference and extent i have added.

i've stopped the program with break point before the second raster layer created and checked the folder, it has the aux.xml and jgw files but the raster layer wont see it until i restart the program.

seems like there is some kind of cache that needs to be cleared after i create the raster object.

any idea?

 

 

 

 

Reply
0 Kudos
0 Replies