Skip To Content

esri_coordsys_set (AutoLISP)

Sets the coordinate system of the current drawing by specifying the path to a valid Esri (.prj) file and WKID.

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 | Valid WKID (well-known coordinate system identification number) 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

Sets the esri coordinate system definition and returns 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

Sets the esri coordinate system definition and returns 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

  • If successful, the function returns a list with the coordinate system information as a string.
  • If failed, returns a list with the first value of nil and then an associated list 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.