1

I am creating a python script to generate a terrain. In the process I am creating two feature datasets. However, in order to successfully create this FD, i need both horizontal and vertical datums. I am able to code the horizontal datum successfully, but unable to input the vertical datum. Although the code does not error out, it does not create the requested feature dataset. I used the ESRI WKID's to reference horizontal and vertical datum as shown below.

Here is the code line for spatial reference that I used:

sr = arcpy.SpatialReference(horizontal_wkid)

I tried doing this sr = arcpy.SpatialReference(horizontal_wkid,vertical_wkid) but to no avail. I am using ESRI ArcGIS 10.2 and coding in Python 2.7

1

Since the given Spatial References in ArcGIS have got their own parameters for the vertical part, as far as I know there is no way of introducing vertical part by using the given factory codes or like

sr = arcpy.SpatialReference(horizontal_wkid,vertical_wkid)

that one may think it should work, but it is not. However, you can create your own spatial reference by borrowing necessary parameters from the given set(s). if you visit this page, there is an example of a similar query. In the question, you will see this definition:

sp=arcpy.CreateSpatialReference_management("GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],VERTCS['NAVD_1988',VDATUM['North_American_Vertical_Datum_1988'],PARAMETER['Vertical_Shift',0.0],PARAMETER['Direction',1.0],UNIT['Meter',1.0]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision","#","#","#","#","#","0")

Here the first part defines the geographic coordinate systems as:

GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]

followed by the vertical system parameters (including name, unit, definition parameters etc.) as:

VERTCS['NAVD_1988',VDATUM['North_American_Vertical_Datum_1988'],PARAMETER['Vertical_Shift',0.0],PARAMETER['Direction',1.0],UNIT['Meter',1.0]]

Then you should be able to introduce this custom spatial reference as an argument to arcpy.CreateFeatureDataset.

  • awesome! ill try it when i get back to the office! – user40720 Jun 28 '15 at 14:06
  • What do you suggest if I had to change my coordinate system numerous times? can i insert variables into this? Please let me know! Thanks. – user40720 Jun 30 '15 at 21:27
  • 1
    Has this answer resolved your problem? If so, please mark this as the answer and submit your question as a new one since it is a bit different than this one. – fatih_dur Jul 1 '15 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.