Select to view content in your preferred language

Python Script

4425
4
Jump to solution
09-01-2014 06:05 AM
MANESK
by
Occasional Contributor

Hi..

How to fetch EPSG code of a shapefile in arcgis using python.....Thanks in advance

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

I used a slight variant of the above approach

import arcpy

descObj = arcpy.Describe("myLayer")

SRef = descObj.spatialReference

print SRef.factoryCode

View solution in original post

4 Replies
ThomasGassner
Esri Contributor

Hello,

here the code for GCS

import arcpy

desc = arcpy.Describe(r"C:\DemoData\PYTH_10_2\Sharing_scripts\World\Cities.shp")

code =  desc.spatialReference.GCSCode

for PCS take the property desc.spatialReference.PCSCode

Let's have a look here too:

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

Kind regards,

Thomas

DuncanHornby
MVP Notable Contributor

I used a slight variant of the above approach

import arcpy

descObj = arcpy.Describe("myLayer")

SRef = descObj.spatialReference

print SRef.factoryCode

ThomasGassner
Esri Contributor

perfect... thats better

0 Kudos
MANESK
by
Occasional Contributor

Thanks for all...

0 Kudos