Select to view content in your preferred language

How can I convert an arcpy geometry object to a shapefile?

5465
12
02-26-2011 09:48 AM
SeldaSamiri
Emerging Contributor
Hi there,

I'm quite new to arcpy, so maybe this is stupid question:

I have a script that produces streams as polylines for every branch one line. I use "unsplit line" to merge them to one line with a geometry object as output. This is done several times (several streams) so in the end I have a list with several geometry objects that contain polylines.
Now I want to convert these geometries to a shapefile or geodatabase feature. How can I do this?

CopyFeatures_managements needs a shapefile/Feature as input. Is there a similar tool/opportunity for geometry objects?

Thanks for any help!

Selda
0 Kudos
12 Replies
SeldaSamiri
Emerging Contributor
And you are saying that after the code to create the geometry list that when you loop through the geometry list and process each individually that you get 5 feature classes each with one feature with unique geometry and if you process the whole geometry list you can one feature class with 5 features each with the same geometry?


yes, exactly!


And it get's even stranger: Although I didn't change anything special in the code (I only replaced some fixed pathnames to scratch pathnames) now it works in the python editor. But when I run it as a tool in ArcGIS with GetParametersAsText for the arguments, then it's the same again: 5 times the first polyline in the list.
By the way: It's the same when I use the merge tool instead of CopyFeatures.


Also just to verify you might want to try running the code below just to get more of an idea of the geometry in the list. If the extents are different then the geometries you are creating are different and I am not really sure why they would not be outputed that way when passed to Copy Features.


Your code gives me the following output, so they seem to be really different...:
Min X: 572739.2346, Min Y: 5607458.6527, Max X: 573639.9422, Max Y: 5608326.5093
Min X: 570178.8781, Min Y: 5607424.5708, Max X: 570601.3457, Max Y: 5608190.19
Min X: 571531.150513, Min Y: 5608746.4787, Max X: 572402.529724, Max Y: 5609681.87512
Min X: 569459.7907, Min Y: 5605696.8935, Max X: 569944.0459, Max Y: 5606899.4698
Min X: 569459.7907, Min Y: 5605471.2531, Max X: 569877.6495, Max Y: 5606705.4056


I'm really at a loss...
Yes, I will contact the technical support, maybe they have an idea.

Thanks for trying to help me!

Selda
0 Kudos
ChrisFox3
Frequent Contributor
Yes at the least I think tech support could get your full code sample and some sample data to reproduce the issue and potentially log a bug. I would be interested to hear what the final outcome is.
0 Kudos
SeldaSamiri
Emerging Contributor
Weeks of discussion with the tech support did not help, but after the installation of Service pack 2 this problem does not exist anymore...

Cheers,
Selda
0 Kudos