Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I used to run this length calc on my data in ArcGIS 8 and 9, and now it don't work in ArcGIS10. Can you tell me what I have done wrong?

Dim dbllength as double
Dim pcurve as icurve
Set Pcurve = [shape]
Dbllength = Pcurve.Length
Length = dbllength
share|improve this question

3 Answers 3

Calculate Field with geometry in 10.x REQUIRES that you use Python. VBScript access to geometry is no longer supported.

Python is the recommended scripting language for ArcGIS. Use Python if you want access to geoprocessing functionality, including feature geometry.

Use VBScript if you have VBA or VBScript experience and are comfortable with the scripting syntax. Saved .cal files from previous versions of ArcGIS may work or require minimal modifications. If you have VBA (I think they mean VBScript) code from past releases that use ArcObjects, you will need to modify your calculations to work in 10.0.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Calculate_Field_examples/005s0000002m000000/

I think the suggestion to use VBScript is bad advice... VBScript expressions cause the Calculate Field tool to fail in 64-bit environments (Background geoprocessing, ArcGIS Server, standalone python scripts running in 64bit).

share|improve this answer

do you mean inside the field calculator?

in this case I suggest you to use python because starting from 10.0 it's the "official" language supported in ArcGIS

10.0 is the last ArcGIS version that uses VBscript, staring from 10.1 it will be deprecated and unsupported

with Python in field calculator you have to use !Shape.length! or !Shape.area! (Python "!" replace VBScript "[")

share|improve this answer
1  
Actually, Esri documentation actually states that 10.0 will be the last DESKTOP version to support VBA (as opposed to VBScript, will still be supported). "ArcGIS 10.0 is the last release with full Microsoft Visual Basic for Applications (VBA) support. With ArcGIS 10.1 we will no longer support VBA development." See page 2 under ArcGIS Desktop 10.0: resources.esri.nl/downloads/ArcGIS_10_Deprecation_Plan.pdf. However, ArcGIS SERVER will no longer support VBScript after 10.0. –  RyanDalton Nov 14 '11 at 21:35
    
You're right but as far as I know VbScript is based on vba support and in turn I'm quite confident it will be discontinued from 10.1 –  robymes Nov 15 '11 at 8:25

it is much easier now in 10.
Right click on the length field and select calculate geometry.
length1
you can select the pcs of the data or the document,
then select the units.
length2

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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