public SpatialReference ToSpatialReference()
Public Function ToSpatialReference() As SpatialReference
public SpatialReference ToSpatialReference()
Public Function ToSpatialReference() As SpatialReference
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
// Use a builder convenience method or use a builder constructor. // Builder convenience methods don't need to run on the MCT. SpatialReference sr3857 = SpatialReferenceBuilder.CreateSpatialReference(3857); // Builder constructors need to run on the MCT. ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { using (SpatialReferenceBuilder srBuilder = new SpatialReferenceBuilder(3857)) { // do something with the builder sr3857 = srBuilder.ToSpatialReference(); } });
// Use a builder convenience method or use a builder constructor. string wkt = "GEOGCS[\"MyGCS84\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Radian\",1.0]]"; // Builder convenience methods don't need to run on the MCT. SpatialReference sr = SpatialReferenceBuilder.CreateSpatialReference(wkt); // Builder constructors need to run on the MCT. ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { using (SpatialReferenceBuilder builder = new SpatialReferenceBuilder(wkt)) { // do something with the builder SpatialReference anotherSR = builder.ToSpatialReference(); } });
Target Platforms: Windows 11, Windows 10, Windows 8.1