dotConnect for Oracle Documentation
In This Topic
    Area and Distance Units
    In This Topic

    Some Oracle functions accept an additional argument "unit", that allows setting measurement unit for function result. Particularly this applies to the functions, returning the length of an object, distances between objects, and area of objects.

    DbGeometry/DbGeography classes have their own methods to get these values (Length, Area, and Distance), however they cannot use this Oracle-specific feature of selecting measurement units directly.

    User can specify the necessary measurement units with GeometryDistanceUnit / GeographyDistanceUnit and GeometryAreaUnit / GeographyAreaUnit settings. The default values of these settings are DistanceMeasurementUnit.Default and AreaMeasurementUnit.Default.

    var config = OracleEntityProviderConfig.Instance;
    config.SpatialOptions.GeometryDistanceUnit = DistanceMeasurementUnit.Meter;
    config.SpatialOptions.GeographyDistanceUnit = DistanceMeasurementUnit.Mile;
    config.SpatialOptions.GeometryAreaUnit = AreaMeasurementUnit.SquareKilometer;
    config.SpatialOptions.GeographyAreaUnit = AreaMeasurementUnit.Acre;
    
    
    Dim config = OracleEntityProviderConfig.Instance
    config.SpatialOptions.GeometryDistanceUnit = DistanceMeasurementUnit.Meter
    config.SpatialOptions.GeographyDistanceUnit = DistanceMeasurementUnit.Mile
    config.SpatialOptions.GeometryAreaUnit = AreaMeasurementUnit.SquareKilometer
    config.SpatialOptions.GeographyAreaUnit = AreaMeasurementUnit.Acre
    
    

    Alternatively, you may specify measurement units in the project config file. For this, you need to update or add the configSections element like it is described in the Entity Framework Provider Configuration section and then add the following Devart.Data.Oracle.Entity tag to the configuration tag:

     <Devart.Data.Oracle.Entity xmlns="http://devart.com/schemas/Devart.Data.Oracle.Entity/1.0">
      <SpatialOptions
        GeometryDistanceUnit="Meter" 
        GeographyDistanceUnit="Mile"
        GeometryAreaUnit="SquareKilometer"
        GeographyAreaUnit="Acre" />
     </Devart.Data.Oracle.Entity>
    

    Note: If you need to set multiple Entity Framework provider options for dotConnect for Oracle, don't add multiple Devart.Data.Oracle.Entity tags. Specify all settings in one Devart.Data.Oracle.Entity tag.

    The following measurement units are available:

    DistanceMeasurementUnit:

    AreaMeasurementUnit:

    See Also

    Choosing Spatial Service  | Default SRID  | Tolerance  | Spatials Comparison  | Oracle Spatial Engine  | Spatial Type Name Representation