ThinkGeo.com    |     Documentation    |     Premium Support

Can't rotate GdiPlusRasterLayer

I am trying to add an image which is rotated, but I have some problems.

I change the world file which format is described in en.wikipedia.org/wiki/World_file.

When I change the rotation constants, line 2 and 3 in the world file, the image is always non-rotated.


I am using the example "LoadAStandardImageWithWorldFile" from the getting started "HowDoISamples"-project. 

What I have done wrong or is it a generel restriction for images ?


private void LoadAStandardImageWithWorldFile_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); GdiPlusRasterLayer worldImageLayer = new GdiPlusRasterLayer(@"..\..\SampleData\Data\world.tif"); worldImageLayer.UpperThreshold = double.MaxValue; worldImageLayer.LowerThreshold = 0; LayerOverlay ImageOverlay = new LayerOverlay(); ImageOverlay.Layers.Add("WorldImageLayer", worldImageLayer); winformsMap1.Overlays.Add(ImageOverlay); winformsMap1.CurrentExtent = new RectangleShape(-118.098, 84.3, 118.098, -84.3); winformsMap1.Refresh(); } /* World file: ..\..\SampleData\Data\world.tfw 0.036 -0.01 0.01 -0.036 -120.0 10.0 */ 


 


 




 



Niels, 



Thanks for your post! 



We do not support the Rotation for ImageLayer even though you changed the constants in the WorldFile. Currently, we supports the rotation only for Feature Layer now. 



We added this item to our work tracking system, hopefully we can supported it one day. 



Sorry for the inconvenience now. 



Thanks. 



Yale 

 



Has the ability to rotate a GDIPlusRasterLayer ever been implemented?

Thank you for the post, rotation of raster layers has not been implemented yet in Map Suite.  However you can help set the priority by voting this enhancement up on the Enhancement Tracker at helpdesk.thinkgeo.com/EnhancementTracker 
  
 To find the enhancement just search for  RasterLayer Rotation 
  
 Thanks!

Any update on the plan when this feature would be available?


Would it be available in Silverlight edition as well? Since this is going to be a part of core, I assume its availability in Silverlight edition as well.


Thanks - Muneswar



Muneswar Rao, 
  
    I know that the Development team has been working on this but I cannot give you a specific date for this. I imagine this is going to be a new feature for the next public release in may, the version 6.0. And since this is implemented in Core, this feature is going to be available to all editions including the SilverLight edition. Thank you.

I just ran into this in version 8.0.  I have a number of shape layers in front of a GdiPlusRasterLayer displaying a satellite image background (image and world file).  I can rotate the shape layers quite easily with a projection, but looks like the inability to rotate the image layer may be a show stopper.  So I’m hoping this has been addressed somewhere and I’m just not finding it.

Hi Rush,



Sorry to say the rotation image layer is not implemented yet in map suite. But we are planing to implement a feature that to rotate the map canvas. We have added this feature into our todo list and will work on it someday.



Sorry for any inconveniences.

Troy

On the list since 2009, and a seemingly very obvious omission, afraid I won’t be holding my breath on that one. 
  
 So what is the answer then?  This is one of my clear requirements.  It worked before the 3.0 rewrite, and existing clients are going to expect it in the new update.  With all these GPS-ish map samples, I can’t be the only one who needs to rotate a satellite or aerial image in sync with other layers (obvious by this thread alone).  Rotating an image isn’t a big deal, but keeping it in sync with the shape layers (zoomed, panned, rotated) may be rather more of a challenge.  I would guess the best approach would be to extend the GdiPlusRasterLayer, but not sure if all the necessary hooks are available.  In all this time has there not been even some sample code you could provide to aid in the effort?  Or is that why there is no sample code?  Perhaps it’s simply not possible through extension.  I suppose at some point I’m going to have to give it a try and find out…

Russ,



We were adding rotation to WPF Edition, which is
a reason we didn't spend much time adding it to Desktop. Here is a WPF sample
showing multi touch to rotate in WPF, have a look if you are interested. 

wiki.thinkgeo.com/wiki/Map_Suite_Wpf_Desktop_Edition_All_Samples#Map_Rotation_and_Multi_Touch.28WPF.29



I was trying to write some extension code for
you, but like you said even rotating an image isn't a big deal, keeping it in
sync with the shape layers is more of a challenge. I am sending it to
our product guys and would give it a high priority. 



Ben



Thank you!  I’m running out of time today, but I’ll look at the WPF when I can.  And I very much look forward to an update to help with doing this in the Desktop control.

Hi Rush, 
  
 We will update here if any progresses.  
 Any other questions, don’t hesitate to let us know. 
  
 Thanks, 
 Troy

Any news on this front, perhaps an ETA?  I’ve got a meeting tomorrow with the product lead and dev manager to discuss realities of our feature list for the new map integration, and I would like to give them an update.  Hopefully positive?

Hi Russ,



I am sorry to reply you so late.



I viewed the WPF edition rotation and found it’s not implemented in our map control, so I implement that for GdiPlusRasterLayer in Desktop Edition, wish the code is helpful for you.


Regards,



Don

Thank you.  We are in the integration phase now, and rotation wasn’t a requirement (only much wanted), so I’ll circle back on the next iteration.

Hi Russ, 
  
 That’s good, any question please let us know. 
  
 Regards, 
  
 Don

Hi 

I downloaded the "Touch event WPF Edition" demo and I can see the rotation of the map is been done by rotating the canvas  FrameworkElement of the map.

My map contain several LayerOverlay and each one contain RasterLayer. Can I rotate each overlay independently by getting the Overlay/rasterlayer canvas in same way, and rotating it in the same method you you in the demo on the map canvas?

(if it is possible how can i get the canvas element of the  Overlay/rasterlayer ?)



Is the rotation on raster layer had been implemented yet?

By reading the comments in this thread it seams that this functionality is not supported yet, I will appreciate your update on the matter.



Thank you

Hi Miri, 
  
 If you want to rotate overlay by canvas, you can just make it works like what the sample shows, that’s not really rotate layer, in fact it should be rotate the WPF element, so this solution should have some problems. 
  
 We are implementing raster layer rotation, but it hadn’t been released, please wait our update on that. 
  
 Regards, 
  
 Don

thank you very much,

waiting to your update on the issue.

Hi Miri,  
  
 Any other question please let us know. 
  
 Regards, 
  
 Don