How to add polygon features from text file to the map view?

Look for DigiTerra Explorer 7 tutorials, tips, tricks and how to's here.
User avatar
Balazs Hober
Site Admin
Posts: 260
Joined: Fri Aug 08, 2008 12:53 am
Location: Hungary, Budapest
Contact:

How to add polygon features from text file to the map view?

Postby Balazs Hober » Wed Jan 23, 2013 11:03 am

The easiest way to import 2D polygons from an ASCII text file into DigiTerra Explorer if you are using the Atlas BNA ASCII exchange format.

:idea: If you have a text file with point lists of the polygon vertices the only thing you need to do is to edit the point list of the vertices taking care to maintain the order of the vertices in the following file format below. Then rename the file from TXT to BNA and you can add it as a layer to the map view.

BNA files can contain three types of objects:

• Polygons are three or more line segments that begin and end at the same point to form a closed figure. Areas can be used to represent any closed boundary, such as a county or city limits.
• Lines are two or more line segments that do not begin and end at the same point and do not form a closed area. Lines can be used to represent roads, rivers, etc.
• Points are single locations that can be used to locate transmitter sites, buildings, etc.

All boundary information in the file is represented by latitude/longitude - easting/northing pairs that define the end points of line segments (for lines and polygons) or single point locations. Coordinate values are indicated by decimal degrees of latitude and longitude. West longitudes and south latitudes are negative numbers to maintain normal plotting conventions (x values increase going right [east] and y value increase going up [north]).

The file format is:

Code: Select all

"Pname 1","Sname 1",type/length
x1,y1
x2,y2
x3,y3
...

"Pname 2","Sname 2",type/length
x1,y1
x2,y2
x3,y3
...

where:

Pname is the primary name identifier for the object, enclosed in '"' marks. This Primary ID is typically a numerical identifier for the object. The Primary ID can be used to link boundary information to other data base items. This is the ID field in the attribute table when loading the BNA file in DigiTerra Explorer.

Sname is the secondary name identifier for the object, enclosed in '"' marks. This Secondary ID is typically the name of the object. This is the Label field in the attribute table when loading the BNA file in DigiTerra Explorer.

Type/length is the identifier that indicates the type of object (point, line, polygon) and the number of latitude/longitude - easting/northing pairs used to represent the object in the file.

• A positive integer greater than 2 indicates a polygon. The value indicates the number of coordinate pairs to follow. The last and first coordinate pairs should be the same to ensure a closed area.
• A negative integer less than -1 indicates a curve (or line). The absolute value defines the number of coordinate pairs to follow.

• The integer 1 indicates a point. Only one coordinate pair is allowed.

BNA example:

Code: Select all

"1","polygon1",10
116000,258000
115500,288000
162000,288000
163500,260000
160500,249000
151000,256000
149000,267500
131000,264000
128000,255500
116000,258000
"2","polygon2",4
199500,286500
228000,249500
184000,250500
199500,286500
"3","polygon3",10
264500,284000
280000,280500
290500,278000
291500,263000
284500,250000
277000,245000
255500,246500
249000,258500
253000,276500
264500,284000
Attachments
BNASample.zip
(3.84 KiB) Downloaded 294 times

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 1 guest