Select to view content in your preferred language

SoapConverter FromSoap Bug?

504
0
10-24-2012 12:35 PM
BrianKowalski
Occasional Contributor
Hi,

The more I think about this, the more I think it is not a big deal. But in case someone down the road comes across the same problem.


I am using the SoapConverter to get a Geometry from a FeatureLayer. Most everything works well and I have a workaround but stumbled across what seems like a bug. Please let me know if it is, or, if I'm doing something wrong please let me know.

The problem is in the *apparent* CoordinateSystem of the converted object. I say *apparent* because the *data* is in the correct coordinate system. That is the coordinate system that the FeatureLayer defines in its CoordinateSystem Property.

However, the CoordinateSystem of the converted Geometry says WKID = 4326.

In this state I can???t do anything with the Geometry object because it is invalid, apparent coordinate system of 4326 and data in 3857. I did find that I can just assign the FeatureLayer.CoordinateSystem Property to the convertedGeometry.CoordinateSystem Property.

Here is some code that may help my post make sense.


//Get the PolygonB bytes from the FeatureLayer
XmlDocument doc = new XmlDocument();
doc.LoadXml(featureLayer.DataSourceProperties.XmlRecordSet);
XmlNodeList nodes = doc.GetElementsByTagName("Bytes");
byte[] bytes = Convert.FromBase64String(nodes[0].InnerText);

//PolygonB is an object in the SOAP API. We have created a Proxy Library for these classes
PolygonB polygonB = new PolygonB { Bytes = bytes };
agxGeometry = SoapConverter.FromSoap<ESRI.ArcGISExplorer.Geometry.Geometry>(polygonB);

//We should now have an AGX Geometry that we can work with.
// However, The CoordinateSystem is wrong. It is the *BaseGeographicCoordinateSystem*
// of the FeatureLayer. The following line seems to fix it.
agxGeometry.CoordinateSystem = featureLayer.CoordinateSystem;

//Now we have an AGX Geometry and can do what we need to do.

Thanks much,
0 Kudos
0 Replies