Hello,
I have an issue with the shape of ellipses being distorted after I change projection on InMemoryFeatureLayer.
I am drawing few ellipses, et al., on InMemoryFeatureLayer and then do one reprojection on the whole InMemoryFeatureLayer.
Using this:
manProj4Projection.InternalProjectionParameters = ManagedProj4Projection.GetEpsgParameters(4326);
manProj4Projection.ExternalProjectionParameters = ManagedProj4Projection.GetGoogleMapParameters();// GetEpsgParameters(3785);
I am drawing some graphics on InMemoryFeatureLayer (infl). Here are 2 code examples:
// draw ellipse in EPSG 4326, then reproject whole in memory layer to 3785
EllipseShape ellipse2 = new EllipseShape(centerInLatLng, GlobalVariables.ellipsesShadowRadiusX[idx],
GlobalVariables.ellipsesShadowRadiusY[idx], GeographyUnit.DecimalDegree, DistanceUnit.Meter);
PolygonShape polygon = ellipse2.ToPolygon();
polygon.Rotate(centerInLatLng, (float)GlobalVariables.ellipsesShadowRotation[idx]);
gcs2.Shapes.Add(polygon);
Feature feat2 = new Feature(gcs2);
infl.InternalFeatures.Add("shadow2", feat2);
infl.FeatureSource.Projection = manProj4Projection;
// draw ellipse in EPSG 3785 (centerMeters2 is in meters, and using GeographyUnit.Meter)
EllipseShape ellipse2 = new EllipseShape(centerMeters2, GlobalVariables.ellipsesShadowRadiusX[idx],
GlobalVariables.ellipsesShadowRadiusY[idx], GeographyUnit.Meter, DistanceUnit.Meter);
PolygonShape polygon = ellipse2.ToPolygon();
polygon.Rotate(centerMeters2, (float)GlobalVariables.ellipsesShadowRotation[idx]);
gcs2.Shapes.Add(polygon);
Feature feat2 = new Feature(gcs2);
infl.InternalFeatures.Add("shadow2", feat2);
See attached image.
The first is used to draw the orange ellipses, and the second code block, the blue. Problem is that they are supposed to have the same shape. The first is drawn in EPSG 4326 and then reprojected to 3785 by changing the InMemoryFeatureLayer’s Projection to EPSG 3785. The second is drawn at centerMeters2 which is in meters already.
The re-projection (infl.FeatureSource.Projection = manProj4Projection) makes the object appear in the correct location but the shape is not updated and has the distortion common to 4326
It looks like the layer re-projection does not correct the shape distortion
Is that correct?
Thanks
Thomas