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