ThinkGeo.com    |     Documentation    |     Premium Support

Transforming Features

Hi,

I like to transform some Features so they fit in a given geometric range.
Example: We get a surveying, but the data isn’t georeferenced.
So we Need to transform the data to the rigth Location using 4 or 6 Parameter (Helmert or Affine).
Is there still a function build in MapSuite to do that? Or any snippet?

Regards
Hardy

Hi @Hartwig,

I think what you want should be projection, you can modify the projection string to transform the feature.

But I don’t have more understand about Helmert and Affine, but the proj4 string contains some parameters, for example, if you modify the x_0, you can make the feature goes right or left.

If you think I misunderstand anything please let me know.

Regards,

Don

Don,
I don’t want to transform using projection.
I simply like to use something like Feature.translate(dx,dy) or Feature.rotate(z)…=> Feature.transform(p1, p2,p3,p4…p6)
Returning a new Feature (or the Feature at a new Position) in the same coordinate System.
In front of that i like to select 2 source Points and 2 Destination Points, calculate dx, dy and Rotation angle and scaleX and scaleY so I have the Transformation Parameter (p1,p2…p6) to change the Feature in the actual coordinate System from one place to an other.
Hope I describe the Task well.

Regards
Hardy

Hi Hardy,

Thanks for the further information. I guess there are 2 solutions for that:

  1. Use methods FeatureLayer.EdiTools.TranslateByOffset(string featureId, double xOffset, double yOffset, GeographyUnit shapeUnit, DistanceUnit offsetUnit) and FeatureLayer.EdiTools.Rotate(string featureId, PointShape pivotPoint, float degreeAngle), please see code snippet below:

    private void TranslateByOffset(double xOffset, double yOffset)
    {
    featureLayer.Open();
    featureLayer.EditTools.BeginTransaction();
    featureLayer.EditTools.TranslateByOffset(“featureId”, xOffset, yOffset, GeographyUnit, DistanceUnit);
    featureLayer.EditTools.CommitTransaction();
    featureLayer.Close();

         overlay.Refresh();   
     }   
    
  2. Use method BaseShape.TranslateByOffset(xOffset, yOffset, shapUnit, offsetUnit) and BaseShape.Rotate(pivotPoint, degreeAngle).

    BaseShape baseShape = feature.GetShape();
    baseShape.TranslateByOffset(xOffset, yOffset, shapeUnit, offsetUnit);
    //Update the feature to the FeatureLayer

Hope it’s helpful.

Thanks,
Peter

Peter

thank you for your snippet.
My hope was to get a compact method for transforming Features direct from MapSuite.
Your Suggestion is ok and I will have to build a function to handle that.

Regards
Hardy

Hi Hardy,

Very glad to hear it works. Any questions please let us know.

Thanks,
Peter