< Day Day Up > |
What is vector data? This quote is a good description of what vector data is:
MapServer can access vector file formats and database connections. It can also access raster or image data. This is a summary of the vector and database formats with particular focus on how to use them in a MapServer map file and access them using command-line tools such as ogrinfo. B.1.1. MapServer and Vector Data AccessMapServer offers two methods for accessing data:
B.1.1.1 Using OGROGR is used behind the scenes by MapServer when requested. MapServer doesn't require OGR in order to run. Some users may never need the additional capabilities OGR offers, but many users find them absolutely necessary. Because MapServer can access data via OGR, you don't have to program specific types of data format support directly into MapServer. Instead, you can make further additions to OGR and then use MapServer. In essence, the background libraries allow MapServer to bring the data into an internal, memory-based format that MapServer can use. For the most part, using OGR-related formats is seamless and intuitive. B.1.2. Data Format TypesThere are three types of data mapping and GIS data formats. Each type is handled differently. Here are the types and some example formats:
Each type of data is made up of a data source and (one or more) layers. These two definitions apply to MapServer and OGR:
B.1.2.1 File-based dataFile-based data consists of one or more files stored in any arbitrary folder. In many cases, a single file is used (e.g., DGN) but ESRI shapefiles, for example, consist of at least three files, each with a different filename extension: SHP, DBF, SHX. In this case all three files are required because they each perform a different task internally. Filenames usually serve as the data source name and contain layers that may or may not be obvious from the filename. In shapefiles, for example, there is one data source per shapefile and one layer that has the same name as that of the file. B.1.2.2 Directory-based dataDirectory-based data consists of one or more files stored in a particular way within a parent folder. In some cases (e.g., coverages), they may also require additional folders in other locations in the file tree in order to be accessed. The directory itself may be the data source. Different files within the directory often represent the layers of data available. For example, ESRI ArcInfo Coverages consist of more than one file with an ADF file extension, within a folder. The PAL.ADF file represents the Polygon data. ARC.ADF holds the arc or line string data. The folder holds the data source, and each ADF file is a layer. B.1.2.3 Database connectionsDatabase connections are similar to file- and directory-based structures in one respect: they provide geographic coordinate data for MapServer to interpret. That may be oversimplifying what is happening inside MapServer, but in essence all you need is access to the coordinates making up the vector datasets. Database connections provide a stream of coordinate data that is temporarily stored (e.g., in memory) and read by MapServer to create the map. Other attribute or tabular data may also be required, but the focus of this guide is coordinate data. One important distinction between databases must be made. The databases discussed here are spatial databases, those which can hold geographic data in its own data type. This is opposed to strictly tabular databases that can't hold geographic coordinates in the same way. It is possible to store some very simple coordinate data in regular tables, but for anything but the most simple use, a spatial database is required. There are spatial extensions to many databases (open source and commercial). One of the most robust is the PostGIS extension to the PostgreSQL database. This database not only allows the storage of geographic data, but also allows the manipulation of that data using SQL commands. The other open source database with spatial capabilities is MySQL. Connections to databases usually consist of the following pieces of connection information:
Access to specific pieces of coordinate data usually require:
|
< Day Day Up > |