What is the easiest way to import multiple polygons?

Greg Nash
Global Mapper UserTrusted User
in Vector Data
I have a big list of polygons in excel. It looks something like this:
Name X Y
Poly1 0 0
Poly1 5 0
Poly1 5 5
Poly1 0 5
Poly2 0 5
Poly2 5 5
Poly2 5 9
Poly2 0 9
...
I'm looking for an easy way to import all of them without dividing them into a separate csv file for each polygon. I think that I solved this by using wkt. I can use Excel's "concatenate()" function to create the wkt in a new column and then I just export that column. However, I don't see any way of preserving the name when I do this. After I import all of my polygons, it looks like I'll have to name them by hand. Is there some sort of way for me to import a bunch of polygons as well as their names?
Name X Y
Poly1 0 0
Poly1 5 0
Poly1 5 5
Poly1 0 5
Poly2 0 5
Poly2 5 5
Poly2 5 9
Poly2 0 9
...
I'm looking for an easy way to import all of them without dividing them into a separate csv file for each polygon. I think that I solved this by using wkt. I can use Excel's "concatenate()" function to create the wkt in a new column and then I just export that column. However, I don't see any way of preserving the name when I do this. After I import all of my polygons, it looks like I'll have to name them by hand. Is there some sort of way for me to import a bunch of polygons as well as their names?
Tagged:
Answers
-
Greg,
I created three polygons and exported them using "Simple ASCII (XYZ) Text File", then turned off the original layer and imported the file as a check. The imported shapes had the names capitalized, but that was the only difference. "Survey Line 1" is one of my line styles, and that's how the polygons were styled on import. You might be able to omit DESCRIPTION and specify it on import. Otherwise you would only need to ensure that the appropriate datum/projection was documented.
This would not be the most convenient in Excel, but it looks do-able.
MykleDESCRIPTION=Survey Line 1
NAME=poly1
479817.24451,3553108.56485
479963.38230,3553185.72560
480102.50547,3553145.97613
480093.15265,3552990.48552
479930.64743,3552971.77988
479819.58272,3553109.73396
DESCRIPTION=Survey Line 1
NAME=poly2
480370.22990,3553211.44585
480275.53261,3553321.34147
480262.67249,3553136.62331
480371.39900,3553211.44585
DESCRIPTION=Survey Line 1
NAME=poly3
480409.97938,3553050.10974
480557.28627,3552971.77988
480321.12760,3552854.86965
480166.80610,3552926.18489
480408.81027,3553051.27884
-
Reformatting the file as Mykle suggests above might be a good way to solve the problem, but I just learned that I can use the "Include attributes from lines with coordinate data" checkbox to solve this. I just need to make sure that the attribute information comes after the coordinate information (which doesn't need to be in wkt format). I also checked the "Column headers in first row of file" box and reduced the "Rows to Skip at Start of File" down to zero.
Now, I just need to add rows to close my polygons before I export them so that the "Create Areas from Closed Lines" checkbox will work.
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 639 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 417 Projection Questions
- 829 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 179 Announcement and News
- 922 Bug Report
- 559 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 573 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website