Conversion from spatial information to GML (from SHP file to GML file)

Source: Internet
Author: User
GML has become an accepted and easy-to-understand standard for the exchange of spatial information. Therefore, the conversion of other GIS data into the GML format has broad practical value and market prospects. In the near future, a large amount of spatial information will exist in the GML format, so that people can easily share and exchange spatial information. This will lead to a very important issue, that is, how to convert some existing spatial information into the GML format to better achieve various types of spatial data sharing.

Currently, a large amount of spatial data is stored in specific text data formats. The most common GIS data formats include the SHP files of ArcInfo and the MIF files of MapInfo. Based on the schema description in the gml3 specification, the SHP file and the format of the MIF file, the SHP file and the MIF file can be converted to the GML file. During the conversion process, you must first create a document in the GML format, add the GML description information, and then cyclically convert the geographical information elements in the SHP or MIF file to the geometric elements in the GML. Take the SHP file of ArcInfo as an example. This file is a binary file that contains a fixed-length header file. The header file is 100 bytes in length and contains important attributes of the entire file. For example, the length of the file starts from 24th bytes to 28 bytes, and the version of the file starts from 28th bytes to 32nd bytes; starting from 32nd bytes to 36th bytes, it describes the types of images contained in the file. From 36th bytes to 84th bytes, each eight bytes is a group, the boundary range (xmin, ymin, xmax, Ymax, zmin, and zmax) of the graphic file is described respectively ). The description of object data after 100th bytes, including the description of point, line, polygon and other geometric types. Each geographic object is determined by a group of bytes. The length of each group of bytes varies according to the specified geometric type. Take the point object as an example to describe the object type from the 0-4 bytes and the X coordinate of the point object from the 4-12 bytes, describes the Y coordinate of the vertex object from the 12-20 bytes. The geographical information described in the SHP file corresponds to the GML geometric elements, as shown in the following table.
SHP File GML file
Point Point
Pointm Point
Pointz Point
Multipoint Point or multipoint
Multipointm Point or multipoint
Multipointz Point or multipoint
Polyline Linestring
Polylinem Linestring
Polylinez Linestring
Null shape Dbnull. Value
Polygon Polygon
Polygonm Polygon
Polygonz Polygon
Multipatch Polygon
In addition to the storage of specific text data formats, a considerable amount of geographic information is stored in databases (generally stored in relational databases ). The principle of converting the geographical information into a GML file is similar to the above method. You can program the conversion by finding the ing between the geographical information and the GML geometric elements.

Another common geographic information format is raster data ). Raster Data is composed of square or rectangular raster points. The position of each raster point or pixel is defined by the row and column number of the raster. The corresponding value is the attribute value of the content to be expressed in the raster. The encoding of The Raster image is completely different from that of the XML format. It cannot analyze the syntax, verify the correctness, and have no good format. In addition, the data values of each of its raster points are fixed, so there is no operation flexibility when converting them into XML standard formats. To convert a raster image to GML, you can convert all the raster points into the points in GML. Because raster images usually contain a large amount of information, the converted GML files generally contain a large amount of point information. Currently, converting raster data to GML does not have much practical significance. In addition, gml3 supports raster data. The overwrite mode description is equivalent to the raster data set.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.