Skip To Content

esri_coordsys_set (AutoLISP)

The esri_coordsys_set function sets the coordinate system of the current drawing by specifying the path to a valid Esri .prj file and WKID.

Note:

ArcGIS for AutoCAD requires its own coordinate system information that is distinct and separate from any AutoCAD coordinate system or geolocation information. When working in Civil 3D, whenever ArcGIS for AutoCAD sets an Esri coordinate system, it will also attempt to set a matching Civil 3D GEODATA coordinate system if one is not already set.

Syntax

(esri_coordsys_set prj_path) or (esri_coordsys_set wkid)

Arguments

  • prj_path | string | required | The path to a valid Esri coordinate system definition file.

  • wkid | string | required | A valid well-known ID (WKID) of the Esri coordinate system.

Example usage 1

Attempt to set the Esri coordinate system to the definition contained in the WGS_1984_Web_Mercator_Auxiliary_Sphere.prj file:

(esri_coordsys_set "C:/CADwork/LispCerts/WGS_1984_Web_Mercator_Auxiliary_Sphere.prj")

Result example usage 1

Set the Esri coordinate system definition and return a list containing the resulting coordinate system definition as a string:

("PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]")

Example usage 2

Attempt to set the Esri coordinate system using the WKID number of 3857:

(esri_coordsys_set 3857)

Result example usage 2

Set the Esri coordinate system definition and return a list containing the resulting coordinate system definition as a string:

("PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]")

Return values

The following are the possible return values:

  • If successful, the function returns a list with the coordinate system information as a string.
  • If failed, it returns a list with the first value of nil; then, an associated list is returned containing the key value "Error" and an associated error message as a string: (nil ("Error" . "<message>")).

Failed return values

A failed return value can occur for any of the following reasons:

  • (nil ("Error" . "File not found."))

    The specified file was not found.

  • (nil ("Error" . "Unable to import coordinate system."))

    The specified file may not be readable or did not contain a valid coordinate system reference.

  • (nil ("Error" . "Invalid WKID"))

    The WKID provided is invalid.

  • (nil ("Error" . "Cannot set current coordinate system"))

    You may have attempted to set a coordinate system, but the drawing contains a web feature layer.