It would be very useful to add to the Polyline geometry class in arcpy a method that flips the direction of vertices. This could be done in situ or the method generates a new Polyline geometry (my preferred option). ArcObjects allows you to call such a method. Currently one has to program this logic which is tiresome when it seems such an obvious thing that one might want to do to a Polyline, reverse its direction.
I believe it already exists. I don't know if this is what you are looking for but here is something akin to it.
@RPGIS , I am aware of this geo-processing tool, that requires at least a standard license. I'm suggesting that the list of methods on the geometry polyline class be expanded to include a "flip" method. This would allow for cleaner easier coding and would compliment the long list of existing methods and frankly I'm surprised it does not exist already as reversing the direction of a polyline is a very common task. This should not be a task only accessible to higher license level tools.
I've ran across something similar, but the way I've handled it was to simply convert the polyline into an array of points and then use the reverse method to basically flip the line and then recreate the original polyline.
That's the only method I can think of that will do that using the geometries.
That was my solution, but it just seems like overkill to me, having to create new arrays, inserting points in reverse then rebuilding a new polyline. Exposing it as a method of a polyline would make for simpler and cleaner code. It would probably be more efficient too as I understand that arcpy is often a wrapper to some uber fast c++ code.
That would be simpler, however you could also do a couple of things to make it easier:
Aside from those suggestions you would have to see if Esri would be willing to implement your idea.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.