CreateAreaUnit(String) Method
Convenience method to create a
AreaUnit from well-known test. This method is useful for creating custom units.
AreaUnit - Create an AreaUnit
try
{
var myFactoryCodeInit = AreaUnit.CreateAreaUnit(109439); // 109439 is the factory code for square miles
var myWktUnit = AreaUnit.CreateAreaUnit("HECTARE_AREAUNIT[\"H\",10000.0]");
var myCustomUnit = AreaUnit.CreateAreaUnit("myAreaUnit", 12);
}
catch (ArgumentException)
{
// ArgumentException will be thrown by CreateAreaUnit in the following scenarios
// - if the factory code used is a non-areal factory code (i.e. it corresponds to degrees which is an angular unit code)
// - if the factory code used is invalid (i.e. it is negative or doesn't correspond to any factory code)
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.