Exchange SXF format (text version) |
The open SXF (Storage and eXchange Format) format is intended for storing and exchanging data in GIS systems in purpose of digital map creation and applications developing. The format was originally designed by experts of Russian Army Topographic Service in 1992. SXF format supports two types of data storage: text and binary. This chapter describes text version of SXF format. SXF has a really simple structure and non-dependable on type of data consequence of fields in records. The format provides audit possibility of data integrity during storage and after transmission on communication circuits, and also minimum information losses at origin of the data errors. SXF format allows to make archives of digital maps and exchange spatial data between GIS systems. There are some SXF characteristics listed below: - all data stored in one file, so information can't be locate in archive or outputs to a customer in an incomplete structure, search and registration of files is facilitated; data sampling from the file can be done by single series reading of the file, that accelerates processes of copying, control of data structure, converting and other, being main for storage and exchange; - the information on separate object is stored as sequentially arranged strings, there are no address references between parts of the file or miscellaneous files, that provides correct data processing after failures program or hardware; if at reading or data record into SXF format there is a failure reducing to loss of a file fragment, records arranged before and after a fail site, will be processed correctly; - SXF contains auxiliary fields (identifiers of a records beginning, identifier of a beginning-of-file, descriptor of dataset, etc.) used for verification of file or restoring data after program failures, or realization of data audit at durable storage in archive; - SXF can store 3D object coordinates (object metric ) as doubles (either as integers) to provide high precision of measurements; - passport dataset can be expanded based on user needs; - format does not include the information about displaying or printing styles of objects - they are defined in classifier tables. Format structure In the Text (character) form of representation SXF format allows to write the digital vector data about district as a text file. The given possibility is intended for support data exchange process between different assignment GIS systems working on miscellaneous hardware-software platforms.
SXF file general structure SXF format can have text representation as a file of following structure: .SXF Edition _ of the format Р001 Nomenclature (Map sheet title) ... P101 B L of a southwest corner P102 B L of a northwest corner ... P207 scale factor ... .DAT number_of_map_objects .OBJ object_code object_type .KEY object_ID .GEN object extents (minimum_maximum) .GRP number_of_object_group .MET number_of_subobjects number _ of _object_points x y H or B L H (depending on a coordinate system) ... number _ of_subobject_ points (if number of subobjects > 0) x y H or B L H ... .SEM number_of_characteristics The code _ the characteristics a value _ the characteristics ... .OBJ Object _code object_type ... .END
The text file in the format SXF consists of a set of strings (lines) of variable length in ASCII codes. The strings should be ended by the escape characters "\x0DOA". At the beginning of string there can be Point-symbol which follows by one of the following keywords - SXF, DAT, OBJ, KEY, GEN, MET, SEM, END etc or by the appropriate value related to sheet or object Empty strings are permitted as well as strings that contains space characters, end-of string characters and comments strings (started at "//" symbol). Mandatory strings contain keywords SXF, DAT, OBJ, END. The first file string must contain keyword SXF and format version ID (for example 3.0) separated by space character. At the beginning of the file there should be passport data, related to the map sheet, following by object-related data. The section of passport data is optional. The map objects description section started with a string that contains DAT keyword and the number of objects value, separated by space character The description of the single object begins with string that contains keyword OBJ, classification code of the object and type separated by spaces. Keyword END placed at the end of digital dataset. There is a sample of SXF file below (minimum version) .SXF 3.0 .DAT 1 .OBJ 1 LIN 1 0 0 .END If there is no passport section in the file, it has to be treated as local coordinate system dataset. SXF dataset dimensionality (3D or 2D) as well as coordinates input accuracy are arbitrary and are set when processing automatically. Passport structure Passport data section is located at the beginning of the file between strings, containing SXF and DAT keywords Passport data organized as strings, containing identifier of passport parameter (Pxxx) and its corresponding value. ID and its value separated by space character. For example P001 (sheet title) 1 (parameter number 1). See Appendix 3 about Passport data section for binary SXF file. Most common parameters of passport data are listed below: P000 Arbitrary title of a page P001 Code of the nomenclature (sheet title) P002 General type of a map Geodetic coordinates of a map framework in radians (floating point values delimited by space character) P101 B L of a southwest corner P102 B L of a northwest corner P103 B L of a northeast corner P104 B L of a southeast corner Rectangular coordinates of corners of a framework in meters, (floating point values delimited by space character) P109 X Y of a southwest corner P110 X Y of a northwest corner P111 X Y of a northeast corner P112 X Y of a southeast corner P116 Coordinate system P117 Vertical datum P118 Ellipsoid P119 Map projection Р120 Frame type P207 Map scale factor The notes: 1. General types of a map: 1 - topographic, 2 - geographic, 3 - space navigation, 4 - topographic city plan, 5 - large-scale plan, 6 - aeronautic, 7 - seanautical, 8 - aviation, 9 - scheme. Dependence between the type of a map and other characteristics of the passport is as following. The type of a map : topographic geographic Ellipsoid : Krasovsky Krasovsky Verticl datum : Baltic Baltic Projection : Gauss - Kruger any except Gauss - Kruger Coordinate system : Pulkovo 1942 rectangular Frame type : the trapezoidal depends on project The type of a map : space navigaion Ellipsoid : Krasovsky Vertical datum : Baltic Projection : cylindrical special Coordinate system : unknown Frame type : rectangular. The type of a map : topographic plan large-scale plan Ellipsoid : Krasovsky Krasovsky Vertical datum : Baltic Baltic Projection :Gauss - Kruger unknown Coordinate system : Pulkovo 1942 local Frame type : rectangular rectangular The type of a map : aerial navigation Ellipsoid : Krasovsky Vertical datum : Baltic Projection : conformal conic modified polyconic, Coordinate system : local Frame type : trapezoidal. The classification above is not complete and can be expanded 2. Coordinate systems: 1 - Pulkovo 1942, 2 - Universal Transverse Mercator 3 - national grid of Great Britain (National Grid), 4 - rectangular local coordinate system (is large scale plan), 5 - Pulkovo 1963, 6 - rectangular arbitrary for general maps, depends on projection type, values of standard parallels and central meridian, 7 - geodetic coordinates according to Ellipsoid 3. Vertical datums: 1 - Baltic elevation system of height (based on Kronstadt graduated pole); 6 - average sea level in a English Channel (Great Britain); 16 - average level of Northern sea - zero point Graduated pole "Normal - zero point" (Netherlands, Germany); 22 - average level of the Mediterranean sea in Topsail (France, Switzerland); 24 - average level of the seas and oceans around USA and Canada (USA, Canada). 4. Map projection: 1 - Gauss - Kruger, 2 - conformal conic, 3 - cylindrical special for space navigation Maps of a scale of 40 000 000, 4 - Lambert azimuthal equal-area 5 - stereographic, 6 - azimuthal equidistant (Postel), 7 - azimuthal oblique equidistant 8 - transverse Mercator, 9 - cylindrical arbitrary Urmaev, 10 - polyconic projection CNIIGAiK, 11 - modified polyconic, 12 - pseudoconic arbitrary projection, 13 - stereographic polar, 14 - conformal projection (Chebyshev), 15 - gnomonic (origin point 60,80 degrees) 16 Universal Transverse Mercator (UTM) 5. Ellipsoid: 1 - Krasovsky of 1942; 2 - International 1976 (WGS - 76); 3 - Heisford 1909; 4 - Clark of 1880; 5 - Clark of 1866; 6 - Everest of 1857; 7 - Bessel of 1841; 8 - Airy of 1830; 9 - international 1984 (WGS - 84). 6. Frame type: 1 - trapezoidal; 2 - trapezoidal with points of a break; 3 - rectangular; 4 - circle. The classification above is not complete and can be expanded Map objects data structure Map objects data section is located between strings, containing DAT and END keywords The number of objects is placed after DAT keyword separated by space character (or spaces) Data related to single object consists of reference data, metrics data (coordinates) and semantics (object attributes) Reference data structure Reference data is located starting from the string containing OBJ keyword. There is a classification codes of object and type separated by space character. The record format looks like: .OBJ Classification _ the code type The classification code defines a thematic type of object. For example: 31410000 - river, 41100000 - city and so on. The type (second parameter) can be one of follows: LIN - linear objects, SQR - area, DOT - point, TIT - label, VEC - vector objects. After this parameter there can be in arbitrary order unique ID of object, scale range, number of object group, number of subobjects and some other additional information if needed. Following is a record of unique object ID .KEY unique _ id _ of the object Unique object ID is a positive number (up to 2147483647). It can be applied when data updating and for logical links to other objects. The object scale range is as follows: .GEN Lower _ extent upper _ extent It is a range of scales that can be used for object displaying. The range is from 0 to 40000000. There should not be blanks in these values since they are delimiters for record fields. The number of group is used when several object should be logically united. Record format is: .GRP group_number Number of group is an integer from 0 to 65535. Object coordinates structure The coordinate description of the object can consist of several parts. The first part is an object, and the rest of records is a description of subobjects. The subobjects part depends on the object type. For area objects, the subobjects (islands) describe inner boundaries. For example: a glade in a forest, island regions on a swamp and so on. It is not recommended to use subobjects for the description of group of area objects. For line objects the subobjects describe prolongation of objects after a enforced cuts of line. For example: the road that crosses the river or goes under another road, can be discontinued by the bridge, tunnel, pipeline and so on. For labels, the subobjects can describe location of separate strings and separate components of the pattern (line, dot signs). The contents of pattern depend on the classification code (characteristic of wood vegetation, bridges, of pipelines etc. have miscellaneous patterns, which are described in the digital classifier). There is a record for number of subobject following: .MET number _ of subobjects The number of subobjects is an integer from 0 to 65536. If the number of subobjects is equal to zero the given record can not be ignored. The list of object coordinates begins with record containing a number of vertices (integer positive number). Following are records of vertices coordinates. The coordinates of one vertex placed on one string. The record of vertex coordinates looks like: x y H For a rectangular coordinate system or B L H For geodetic coordinates. Type of the coordinate system and some other related information are contained in passport data section. If there is no passport data section in the file, coordinate system is rectangular local as default. The rectangular coordinates are always in meters (as floating point or integer numbers). Geodetic coordinates are in radians. The elevation is always set in meters (for example: -5, 15.75, 8.173E6) , it can be set for all objects, for single objects or not set at all. The number of coordinate records for object must be equal to the number of its vertices. For label objects there should be label text after coordinate values as follows: > TEXT of a LABEL If there is no record containing label text (>...), this metrics describes additional pattern elements (lines, dots, etc) which defined by classification code of object. If the number of subobjects is greater than 0, subobject description follows the object description. Otherwise, semantics description (SEM) or description of the next object (OBJ) or the end marker (END) follows. Semantics (attributes) data structure Semantics dataset starts at the record that looks like: .SEM number _ of_attributes The number of attributes is positive integer. Each attribute is described as: The code of attribute........The value of attribute The code of attribute is an integer from 0 up to 65535. The value of attribute is a statement, including digits, characters, blanks and special symbols (+ -. / and so on). In case when there is no semantics corresponding to the object SEM record can be ignored. After the semantics description there can be next object description located (OBJ) or the marker of the end of dataset (END). .SXF 3.0 // EXAMPLE of a text SXF FILE // RECTANGULAR COORDINATES // TOPOGRAPHIC MAP P000 BERN P001 0. L-32-039-2-2. A P002 1 P101 0.8188502 0.1287180 P102 0.8203048 0.1287180 P103 0.8203047 0.1308997 P104 0.8188505 0.1308998 P109 5199356.6 2376216.0 P110 5208620.7 2376408.1 P111 5208431.0 2385915.0 P112 5199166.9 2385737.7 P116 1 P117 1 P118 1 P119 1 P207 50000 .DAT 4 // LAKE (KEY: 3/4, 3 * 65536 + 4 = 196612) // WATER TYPE- FRESH // SHORELINE FEATURES - CONSTANT // TRUE ALTITUDE - 546 m .OBJ 31120000 SQR .KEY 196612 8 5202894 2378715 5202876 2378775 5202844 2378795 5202784 2378790 5202740 2378713 5202744 2378668 5202804 2378655 5202894 2378715 .SEM 3 33 100 36 100 4 546 // RICH WOOD (KEY: 7/41) // RELATIVE ALTITUDE - 25 m .OBJ 71111100 SQR .KEY 458793 6 5206181 2380839 5206106 2380903 5206113 2380923 5206168 2381003 5206265 2380961 5206181 2380939 .SEM 1 1 25 // BRIDGES (KEY: 6/434) .OBJ 62310000 VEC .KEY 393650 2 5207754 2379350 5207794 2379470 // SERVER (KEY: 6/183) .OBJ 62130000 DOT .KEY 393399 1 5205731 2378440 // CITY LABEL (KEY: 256/2) // TYPE of the FONT 5, CODE of COLOUR - 101, TEXT - "BERN" .OBJ 88000000 TIT .KEY 16777218 1 5203728 2377794 > BERN .SEM 2 14 5 94 101 .END
.SXF 3.0 // EXAMPLE of a text SXF FILE // GEODESIC COORDINATES // TOPOGRAPHIC MAP P000 BERN P001 0. L-32-039-2-2. A P002 1 P101 0.8188502 0.1287180 P102 0.8203048 0.1287180 P103 0.8203047 0.1308997 P104 0.8188505 0.1308998 P109 5199356.6 2376216.0 P110 5208620.7 2376408.1 P111 5208431.0 2385915.0 P112 5199166.9 2385737.7 P116 7 P117 1 P118 1 P119 1 P207 50000 .DAT 4 // LAKE (KEY: 3/4, 3 * 65536 + 4 = 196612) // WATER TYPE- FRESH // SHORELINE FEATURES - CONSTANT // TRUE ALTITUDE - 546 m .OBJ 31120000 SQR .KEY 196612 8 0.8194135 0.1292739 0.8194108 0.1292878 0.8194059 0.1292925 0.8193964 0.1292916 0.8193893 0.1292742 0.8193898 0.1292638 0.8193991 0.1292606 0.8194135 0.1292739 .SEM 3 33 100 36 100 4 546 // RICH WOOD (KEY: 7/41) // RELATIVE ALTITUDE - 25 m .OBJ 71111100 SQR .KEY 458793 6 0.8199360 0.1297456 0.8199245 0.1297606 0.8199256 0.1297652 0.8199345 0.1297833 0.8199496 0.1297732 0.8199360 0.1297456 .SEM 1 1 25 // BRIDGES (KEY: 6/434) .OBJ 62310000 VEC .KEY 393650 2 0.8201782 0.1293969 0.8201848 0.1294242 // SERVER (KEY: 6/183) .OBJ 62130000 DOT .KEY 393399 1 0.8198578 0.1291976 // CITY LABEL (KEY: 256/2) // TYPE of the FONT 5, CODE of COLOUR - 101, TEXT - "BERN" .OBJ 88000000 TIT .KEY 16777218 1 0.8195414 0.1290589 > BERN .SEM 2 14 5 94 101 .END
|