Loading raster images into accelerated layers.

5144
16
10-04-2012 11:27 AM
AaronMorrisett
New Contributor II
I am having issues finding a suitable method of loading a rastered geotiff file into the accelerated layers collection.  My current method that works fine is to load the image into a ElementLayer as follows.

var image = new BitmapImage(new Uri(filePath));
 var newLayer = new ElementLayer();
 var rect = new Rectangle();
 rect.SetValue(ESRI.ArcGIS.Client.ElementLayer.EnvelopeProperty, convertedEnvelope);
 rect.Fill = new ImageBrush(image);
 newLayer.Children.Add(rect);
_esriMap.Layers.Add(newLayer);


This method works fine except I have a accelerated layer collection that is rendering points from GPS readings that needs to be plotted on top of the rastered image.  The only work around I can find is to change the opacity of the Element Layer in order to at least show the points behind the layer.  This is a prefered method, I would like to be able to add the georeferenced image to a layer within my acceleratedLayers collection so I could set the layer order.

If I have not explained my situation well enough let me know and I'll attempt to reword it.

Regards,
    Aaron
0 Kudos
16 Replies
mohscorpion
New Contributor

i have top left and bottom right , latitude and longitude . can i envelope and show it?

0 Kudos
mohscorpion
New Contributor

is there any tool in wpf sdk that i can use to convert normal image files to georeferenced ones?

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,..

If you have the coordinates of the corners, can you create world file? World files for raster datasets—Help | ArcGIS for Desktop

Cheers

0 Kudos
mohscorpion
New Contributor

i prefer not to create additional files , since i am a programmer not a gis expert.

0 Kudos
mohscorpion
New Contributor

is there already written formulas based on raster size and lat/long of corners?

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

This is the basic formula:

It's just a text file based on the file extension of the image e.g. tfw, pgw, etc. Google will help there.

The contents of the file are 6 lines:

5.000000000000 (size of pixel in x direction)

0.000000000000 (rotation term for row)

0.000000000000 (rotation term for column)

-5.000000000000 (size of pixel in y direction)

492169.690845528910 (x coordinate of centre of upper left pixel in map units)

5426523.318065105000 (y coordinate of centre of upper left pixel in map units)

Cheers

Mike

0 Kudos
mohscorpion
New Contributor

thank you very much indeed, it worked!!

0 Kudos