ERROR 010067: Error in executing grid expression. Failed to execute (Contour)

5626
6
07-23-2010 12:26 AM
sridharsirigiri
New Contributor
i have implemented python for generating contour maps clip.. and i processed this functionality in a window.open(window.php).. in window.php it contains python file, i called it by system(/path/python /path/file.py) here is the program...
file.py
import arcgisscripting
import sys
import os
# Create the Geoprocessor object
gp = arcgisscripting.create()
try:
    print "after spline"
InRaster = "C:/ms4w/apps/gmap/rasterdata/PH"
OutPolylineFeatures = "C:/ms4w/apps/gmap/spl/contour1.shp"
InContourInterval = "0.1"
InBaseContour = "1"

    # Check out ArcGIS Spatial Analyst extension license
gp.CheckOutExtension("Spatial")
print "b4 contour<br>"
    # Process: Contour
gp.Contour_sa(InRaster, OutPolylineFeatures, InContourInterval, InBaseContour)
print "aftr contour<br>"


# Process: Clip
gp.Workspace = "C:/ms4w/apps/gmap/spl"
gp.Clip_analysis("contour1.shp", "C:/ms4w/apps/gmap/data/rr1.shp", "C:/ms4w/apps/gmap/spl/finalmap")
print " at last"
except:
    # If an error occurred while running a tool, then print the messages
print "in ecxpet--->"
print gp.GetMessages()


could anyone help me plzz in dis issue...
0 Kudos
6 Replies
JimBarry
Esri Regular Contributor
Moving to the Geoprocessing Forum.  - Jim
0 Kudos
ChrisSnyder
Regular Contributor III
Sometimes the countours are too big to process all at once. Try something like this to make 10ft contours at different intervals, and then merge them all together.

gp.Contour_sa(grid, r"C:\temp\cont0.shp", "100", "0", "")
gp.Contour_sa(grid, r"C:\temp\cont10.shp", "100", "10", "")
gp.Contour_sa(grid, r"C:\temp\cont20.shp", "100", "20", "")
gp.Contour_sa(grid, r"C:\temp\cont30.shp", "100", "30", "")
gp.Contour_sa(grid, r"C:\temp\cont40.shp", "100", "40", "")
gp.Contour_sa(grid, r"C:\temp\cont50.shp", "100", "50", "")
gp.Contour_sa(grid, r"C:\temp\cont60.shp", "100", "60", "")
gp.Contour_sa(grid, r"C:\temp\cont70.shp", "100", "70", "")
gp.Contour_sa(grid, r"C:\temp\cont80.shp", "100", "80", "")
gp.Contour_sa(grid, r"C:\temp\cont90.shp", "100", "90", "")
0 Kudos
sridharsirigiri
New Contributor
i got conto.shp -cont90.shp for dat file.. when am merging files by gp.union_analysis()
gp.workspace = "C:/ms4w/apps/gmap/spl"
gp.union_analysis ("cont0.shp; cont10.shp; cont20.shp; cont30.shp; cont40.shp; cont50.shp; cont60.shp; cont70.shp; cont80.shp; cont90.shp", "contour1.shp", "ALL","","0.03")

error is:
Executing: Union "C:/ms4w/apps/gmap/spl\cont0.shp #;C:/ms4w/apps/gmap/spl\cont10.shp #;C:/ms4w/apps/gmap/spl\cont20.shp #;C:/ms4w/apps/gmap/spl\cont30.shp #;C:/ms4w/apps/gmap/spl\cont40.shp #" C:/ms4w/apps/gmap/spl\contour1.shp ALL # GAPS
Start Time: Sat Jul 31 12:53:58 2010
Failed to execute. Parameters are not valid.
ERROR 000366: Invalid geometry type
ERROR 000366: Invalid geometry type
ERROR 000366: Invalid geometry type
ERROR 000366: Invalid geometry type
ERROR 000366: Invalid geometry type
Failed to execute (Union).


actually am using mapserver 4windows software for sharing files in windows... i need to generate a contour map for a data file specified attribute..
0 Kudos
sridharsirigiri
New Contributor
hello chris,
here is my whole script which is running fairly in arcgis 9desktop and giving clipped contour map...
      
import arcgisscripting
import os,sys
try:
gp.Workspace = "C:/ms4w/apps/gmap/spl"

    # Set the input feature dataset
        inputFeatureDataset = "C:/ms4w/apps/gmap/data/rr1_data.shp"

    # Set the output raster name
        outputRaster = "spline"

    # Set the output extent
        gp.Extent = "77.3698502 16.8435707 78.8627853 17.7117577"

        # Set the attribute field, cellsize, weight and number of points to use
        attributeName = "PH_Aug06"
        cellSize = 0.003472748
        Weight = 0.1
        NoPointsToUse = 5
        print "before check"
        # Check out ArcGIS Spatial Analyst extension license
        gp.CheckOutExtension("Spatial")
        print "after check before spline"
        # Process: Spline
        gp.Spline_sa(inputFeatureDataset, attributeName, outputRaster, cellSize,"REGULARIZED", Weight, NoPointsToUse)
        print "after spline"
        InRaster = "C:/ms4w/apps/gmap/spl/spline"
        OutPolylineFeatures = "C:/ms4w/apps/gmap/spl/contour1.shp"
        InContourInterval = "0.1"
        InBaseContour = "1"
       
        # Check out ArcGIS Spatial Analyst extension license
        print "b4 contour<br>"
        gp.CheckOutExtension("Spatial")
        # Process: Contour
        gp.Contour_sa("C:/ms4w/apps/gmap/spl/spline","C:/ms4w/apps/gmap/spl/contour1.shp","0.5",1,1)##InRaster,OutPolylineFeatures,InContourInterval,"1","1")
        print "aftr contour<br>"
       
       
        # Process: Clip
        gp.Workspace = "C:/ms4w/apps/gmap/spl"
        gp.Clip_analysis("contour1.shp", "C:/ms4w/apps/gmap/data/rr1.shp", "C:/ms4w/apps/gmap/spl/finalmap")
        print " at last"
except:
    # If an error occurred while running a tool, then print the messages
        print "in ecxpet--->"
        print gp.GetMessages()



i need to generate these contour files online.. and when am doing dis python file it is giving error in executing contour_sa()... as i sent my file previously..
so could u give any suggestions regarding this issue...
thank you..
0 Kudos
ChrisSnyder
Regular Contributor III
Yes, like I said in my previous post, you need to split the contours up, and then merge them back together (using the Merge tool, not the Union, which is for polygon spatial overlays by the way).
0 Kudos
sridharsirigiri
New Contributor
hello chris,
i have tried my program in webbrowser while it is creating contour shapefile initially it is creating shape2 file which is error file. i found that after contour_sa() function executes fuly then only contour shapefiles with our specified name ll be created.so i think its problem with permission problem in my php and apache server.

and moreover thanks for ur reply for my query....

i dont know how to do this merging tool, i saw sample example given in arcgis but i dont know how to create object and all that while statements.so please if u could do a small merge program to combine my contour shapefiles. thank you...
0 Kudos