Select to view content in your preferred language

Coordinate string conversion to point, polyline and ploygon features

2321
3
03-22-2016 04:03 AM
NevinWilson1
Emerging Contributor

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

0 Kudos
3 Replies
NeilAyres
MVP Alum

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.

NevinWilson1
Emerging Contributor

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

0 Kudos
DanPatterson_Retired
MVP Emeritus

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.