I have a model that i am trying to add a field then do a filed calculate but i am having trouble getting it right. I have tried the following in VB but keep getting the following error. So i was wondering if someone could help maybe right this in python unless someone can help me get the VB script right.
Thanks.
VB Error
ERROR 999999: Error executing function.
Expected end of statement
Failed to execute (Calc Index 50')
Pre-Logis Script Code:
dim cont as Long
If([CONTOUR_FEET] MOD 50=0) Then
cont=1
Else
cont=0
End if
INDEX_50FT=
cont
Solved! Go to Solution.
Never mind i for got that VB doesn't let you declare any data types.
dim cont
If([CONTOUR_FEET] MOD 50=0) Then
cont=1
Else
cont=0
End if
But my code doesn't do anyting i have "0" in the INDEX_50ft field.
Python in Field calculator:
Presumably some of your records are truly divisible by 50?
Darren i just thought of that. It doesn't seem as some of my records are. I mad contours from a DEM with the Contour tool with contour interval = 2. I assuming in need to re-create my contours from the DEM at every 50 feet if so how do i do that?
Seems to me that if you make contours at every 50 feet, you won't need the expression. Looks like you made contours every 2 feet (or 2 meters? I don't know what units your dem is in...) Assuming units are feet, why don't you try 10 feet intervals? or 20 feet intervals? What level of detail are you looking to display? What is the topography of your area of interest? If you are looking at farm land in Kansas, perhaps your 2 foot interval is appropriate: if you are looking at the Alaska Range, you'll want to go much greater...
I wasn't sure how to make contours, the approach i took was us the Focal Statistics tool run that on the DEM, then use the contour tool. Which I didn't know what actually the "contour interval" meant. I guess what through me off was that the DEM was in meters. I was making it harder that what i should have been.
My main object was to create a contour map that would display contours every 50 or 100 feet a different color, a nice cartographic appearance. Which is why i created a new fields.
I was making it harder that what i should have been
Haven't done that since.... This morning!