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 want to interpolate Z values for the vertexes in the polyline. Shape file contains few polylines. Polylines do have certain vertexes with correct Z value, others do not have Z value (set to ie. 0). As on the picture below.

How do I interpolate (linear interpolation) vertexes with 0 value?

I figured that IZ.InterpolateZsBetween will do that. However, with my programming skills at this point, I am able to use basic geoprocessing tools in Python and realy have no clue how to implement ArcObject in it. Any ideas? Any known examples of that kind of code would be appreciated. enter image description here

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Use IPointCollection http://resources.esri.com/help/9.3/arcgisengine/arcobjects/esriGeometry/IPointCollection.htm to loop through all points in the polyline. Your start point is index 0 (presumably it has the right z) and then loop through all the vertices until you find a point with non-zero z. Then that becomes your end point and you call InterpolateZsbetween. Then you reset you start point to be the end point you just used and keep looping.

Make sure you handle the special cases like avoiding to call InterpolateZsbetween when i is your start index and i + 1 is your end index (hint you just want to set start index to i + 1 and keep going...

share|improve this answer
    
Well, all this seems pretty straight forward while I read it. Knowing my Object Orientated Programming skills, I know that it will be tricky. Thanks a lot, Ragi. Do you have may be a any/similar code, which uses ArcObjects in Ptyhon? I found it the best way to learn by looking at examples, but unfortunately I can't find much re: ArcObjects in Python. Only VBA... –  Tomek Nov 2 '11 at 6:51
    

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.