Coordinate string conversion to point, polyline and ploygon features

1807
3
03-22-2016 04:03 AM
Highlighted
New Contributor II

Hello All, I'd appreciate your advice.

How do I go about importing a string of coordinate pairs stored in a single cell of an Excel table into ArcMap? These may be a single coordinate pair (point), string of coordinate pairs where the first and last pair are the same (polygon) or different (polyline). See screenshot below.

Thanks for your help.

Nevin

Reply
0 Kudos
3 Replies
Highlighted
MVP Frequent Contributor

I think the only way to do this would be to write some python / arcpy code.

Probably read it in as text (csv) is easier.

Logic something like this :

read in the file.

For each line, split into a list object.

Check that the number of elements is even (len(list) % 2) == 0. Just in case we have some funny lines with a missing X or Y.

Then if len(list) == 2 -> create a point geometry.

If len(list) > 2, check if the beginning and end pairs are the same -> create a polygon geometry.

else create a polyline geometry.

If you can upload some of your data here, I am sure someone will give you some code to try.

Highlighted
New Contributor II

Thanks Neil.

At this stage, there would be a bit of a learning curve in order to code something!

How do I upload data to Geonet? I can't seem to see where I can attached a file

Regards

Nevin

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

to attach a file, you can't respond to your question from within your 'mail'.  Simply click on the title of the thread, 'Reply' to someone's post and there should be an 'Attach' in the bottom right of the thread you are creating.