GeometryEngine Error: "...must have equivalent spatial references"

208
1
03-05-2018 02:02 AM
KarinGisperg1
New Contributor

Dear Esri Team!

 

We implement an application with ArcGIS Runtime 100.1 (and 100.2), using .NET Framwork 4.5.2 and VS2015, and running on Windows 10

 

Most of the geometry operations in the GeometryEngine fail with a "...must have equivalent spatial references" exception.

 

Geometry geoCliptest = GeometryEngine.Clip(feat.Geometry, extent);

{"Invalid argument: geometry and envelope must have equivalent spatial references."}

   bei Esri.ArcGISRuntime.ArcGISException.HandleCoreError(CoreError error, Boolean throwException)

   bei RuntimeCoreNet.GeneratedWrappers.Interop.CheckError(IntPtr errorHandle, Boolean throwOnFailure, GCHandle wrapperHandle)

   bei RuntimeCoreNet.GeneratedWrappers.CoreGeometryEngine.Clip(CoreGeometry geometry, CoreEnvelope envelope)

   bei Esri.ArcGISRuntime.Geometry.GeometryEngine.Clip(Geometry geometry, Envelope envelope)

  

In this example we use the MapView Extent and the geometry from a feature.

We compared the Spatial References with 

var test = feat.Geometry.SpatialReference.IsEqual(extent.SpatialReference);

and it returned true.

And manually checked, the wktstrings are equal too:

PROJCS["MGI_Austria_GK_East",GEOGCS["GCS_MGI",DATUM["D_MGI",SPHEROID["Bessel_1841",6377397.155,299.1528128]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",-5000000.0],PARAMETER["Central_Meridian",16.33333333333333],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

 

We created a workaround for our low level operations. Now we convert the geometry parameters like this, and everything works without problems:

 

public static Polygon ConvertPolygon(

            Polygon p)

        {

            var pJson = p.ToJson( );

            Polygon newPolygon = Geometry.FromJson( pJson ) as Polygon;

            return newPolygon;

        }

                              

So what is the problem? I cannot evaluate the side effects of this  workaround, so it cannot stay like this.

 

Thanks in advance,

Karin

Reply
0 Kudos
1 Reply
MortenNielsen
Esri Frequent Contributor

Normally I'd ask for the JSON of the geometries so we can use it to reproduce the issue, but it seems like parsing from JSON fixes the issue.

Is there any way you'd be able to share a stand-alone reproducer sample with me (for instance a unit test snippet?), so I can submit it to the geometry team?

Reply
0 Kudos