Tuesday, 22 May 2018

Do ArcGIS SpatialReference object factory codes correspond with EPSG numbers?


I've got a project where I'm reading in geometry objects from text files to put them in ArcSDE. These geometry objects have an associated EPSG code, and I'm looking for a way to ensure they're in the right projection when I've finished with them.


Having taken a look at the factory codes that I'm interested in, (GCS GDA94; EPSG:4283, and VicGrid 94; EPSG:3111) for a project I'm working on it appears that the EPSG codes correspond directly to the ESRI factory codes for the spatial reference (here and here). This is great, as it means I don't have to worry about navigating to projection files to create SpatialReference objects, for example in the code below:


import arcpy

# Create a spatial reference object using a factory code
#
sr = arcpy.SpatialReference()

sr.factoryCode = int(epsg_code.lstrip("EPSG:"))
sr.create()

Unfortunately I can't find any reference in the ESRI documentation to say whether this holds true all the time or not - I'm guess it does, but I'd rather know for sure. Does anyone know where I'd be able to find out?



Answer



If an Esri well-known ID is below 32767, it corresponds to the EPSG ID. WKIDs that are 32767 or above are Esri-defined. Either the object isn't in the EPSG Geodetic Parameter Dataset yet, or it probably won't be added. If an object is later added to the EPSG Dataset, Esri will update the WKID to match the EPSG one, but the previous value will still work.


There are some limitations. Esri doesn't follow the axes directions that EPSG does, in ArcGIS Desktop at least, it's always longitude-latitude or easting-northing (xy), although we're picking up the axes order in Server now.


I'm intimately familiar with this as I'm the product engineer that handles these for Esri.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...