ThinkGeo.com    |     Documentation    |     Premium Support

Bug in GeoImage rotation?

Hi,

I think somewhere along the way rendering of GeoImage has broken a little bit. This happens if RotationAngle of PointStyle has been set to something else than zero. Is it a bug or am I using it wrong?

Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ThinkGeoMapTester.ArrowUp.png");
GeoImage geoImage = new GeoImage(stream);
featureLayer1.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(geoImage);
featureLayer1.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.RotationAngle = 7;
featureLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
overlay1.Layers.Add(featureLayer1);

image

Regards,
Jarno

Hi Jarno,

What build are you on? Our 13.1 beta builds had this bug for a while, but it was fixed with the final 13.1 release.

Thanks,
John

Hi John,

Build is 13.2.0-beta004. But I now also tried the 13.1.0 stable and the problem persists there as well.

Regards,
Jarno

Hi Jarno,

Can you set
layerOverlay.TileType = TileType.SingleTile;

If you do need the overlay to be MultiTile(the default type), can you set featureLayer1.DrawingMarginInPixel = 30 or something? In a multi tile environment, we set this margin to give each tile some “buffer” so it can fetch the features in the adjacent tile, to avoid this kind of issue.

Thanks,
Ben

Hi John,

Our business code is already using SingleTile for the overlay containing the problematic GPS location layer. Also I tried both that and the margin setting in a separate map tester project. Unfortunately it didn’t help. Any other ideas?

Thanks,
Jarno

Hi Jarno,

I couldn’t recreate the issue. Can you send me a quick demo? Here below is how I modified the HowDoI and the marker looks good with rotation.

This is a known issue in 13.1 bata and should have been fixed. Please remove bin and obj folder and rebuild, it could be the old version was not removed successfully.

Thanks,
Ben

Hi Ben,

I started a new project, added only the latest ThinkGeo.UI.Wpf (13.2.0-beta007), and tried to mimic your implementation. I think the only difference now is that I’m using InMemoryFeatureLayer instead of the ShapeFileFeatureLayer in your example. Could that be the issue? Or the vector overlay?

private void wpfMap_Loaded(object sender, RoutedEventArgs e)
{
	LoadMapOverlays();
}

private void LoadMapOverlays()
{
	WpfMap.MapUnit = GeographyUnit.Meter;

	// Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service and add it to the map
	ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new(ClientId, ClientSecret, ThinkGeoCloudVectorMapsMapType.Light);
	WpfMap.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

	double x = -10776836.12;
	double y = 3912348.04;

	LayerOverlay overlay1 = new LayerOverlay();
	overlay1.TileType = TileType.SingleTile;
	InMemoryFeatureLayer featureLayer1 = new InMemoryFeatureLayer();
	featureLayer1.InternalFeatures.Add(new Feature(x, y));

	overlay1.Layers.Add(featureLayer1);
	WpfMap.Overlays.Add(overlay1);

	PointStyle pointStyle = new PointStyle(new GeoImage(@"./ArrowUp.png"))
	{
		ImageScale = 1
	};

	featureLayer1.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
	featureLayer1.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle);
	pointStyle.RotationAngle = 10;
	
	featureLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
	
	overlay1.Refresh();
}

Thanks,
Jarno

Hi Jarno,

I still cannot recreate it. Here is the demo using beta007 and it works fine for me. Please try it on your side.


RotatePointImageDemo_0724.zip (7.6 KB)

Thanks,
Ben

Hi Ben,

Well this is just most peculiar. I opened the solution you provided in VS2022. Restored NuGet packages, hit rebuild and start debugging. Result:

Same thing on release build. I don’t really know what is different here, other than we are in Finland. Even the build machine in Azure DevOps gives this bug and I don’t think it even uses VS.

Regards,
Jarno

Hi Jarmo,

Can you test the following on your side?

  1. Double click the executable in bin folder see if it has the same issue.
  2. Right click ThinkGeo.Core.dll and ThinkGeo.UI.Wpf.dll in bin folder and see if their version is as expected (beta007).
  3. If they are beta007 and you still get the wrong result when running the executable, copy the bin folder and run it on another machine see if it has the same result.
  4. zip the bin folder and send to support@thinkgeo.com and we will take a look.

Thanks,
Ben

Hi Ben,

I did the abovementioned steps and asked my colleague to verify the problem on his laptop. The only deviating thing is the ThinkGeo.Core.dll being in beta006. That’s the latest our NuGet source has available. Is there already a seventh? Anyway I suspect the 006 should already contain the fix to this issue?

I sent the zipped bin folder by email. Had to split it into two emails because of size limitations.

Thanks,
Jarno

Hi Jarno,

Your executable works correctly on my Windows 11 Enterprise. However, it does have issues on my Windows 10, as well as on Windows_Server-2022. I have no idea why that happened, and we’ve set up the environment and going to dig in.

Again, thanks for your application, and I’ll keep you posted.

Thanks,
Ben

Hi Jarno,

This issue has been fixed in the latest beta 13.2.0-beta009. It worked fine if the system’s scale factor is set to anything other than 100% and that’s why I couldn’t recreate it on my side. Thanks for reporting this issue and let me know if you have any questions.

Thanks,
Ben

1 Like