ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

ConvertLinearUnits

Available with Production Mapping license.

  • Summary
  • Discussion
  • Syntax
  • Code sample

Summary

Converts native data units to linear units such as meters, kilometers, and miles.

Discussion

This function is useful for converting the native data units to units that are easier to measure. For example, if the data is in decimal degrees, it is easier to identify a minimum distance value in kilometers.

Syntax

ConvertLinearUnits (length_value, layer)
ParameterExplanationData Type
length_value

The number of units and the unit of measure to be used, for example, 1000 meters.

String
layer

The layer whose units will be converted.

Layer

Code sample

ConvertLinearUnits example

This script converts the Facilities features to meters.

import arcpy
import arcpyproduction
from arcpyproduction import generalization

# set environment
arcpy.env.workspace="c:/Data/LocalGovernment.gdb"

# Check out Production Mapping license
arcpy.CheckOutExtension("Foundation")

# Define variables
inFeatures="ReferenceData/FacilitySite"
inFeatLayer="Facilities"

# create a feature layer
arcpy.MakeFeatureLayer_management(inFeatures,inFeatLayer)

# Execute ConvertLinearUnits
value=generalization.ConvertLinearUnits("100 Meters", inFeatLayer)

# describe inFeatLayer to determine its linear units
desc=arcpy.Describe(inFeatLayer)
sr=desc.spatialReference
if sr.linearUnitName != '':
    unit=sr.linearUnitName
    print "Converted meters to {0} {1}".format(value,unit)
else:
    print "Converted meters to {0}".format(value)

Related topics

  • Introduction to arcpyproduction.generalization
  • ConvertArealUnits

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal