8 Data Types of ArcGIS Engine

Source: Internet
Author: User

8 types of data in ArcGIS Engine access data is the basis of GIS, and data access is also the prerequisite for any complex spatial analysis and spatial visualization. ArcGIS supports a wide range of data formats, and supports a wide range of data formats. This article describes how to access the following eight data formats in ArcGIS Engine. Readers who have some knowledge about ArcGIS desktop applications are more suitable for reading this article. The sample code in this article is written in C.
• Shapefile
• Coverage
• Personal Geodatabase
• Enterprise Geodatabase
• Tin
• Raster
Before accessing data through ArcGIS, you must first clarify what is a "workspace ". In ArcGIS, a workspace refers to the location where data is stored. The data access mechanism of ArcGIS is to first open the workspace corresponding to the data and then access the data using the workspace. For different data formats, the details of the workspace are also different.

1. shapefile

Shapefile is a file-type space data format. It stores space data and attribute data on disks as files. The following sample code opens the shapefile element class named cities in the D: \ data folder. For a shapefile, the workspace is the folder where it is located. To open the workspace, you need to use the corresponding workspace factory, that is, shapefileworkspacefactoryclass, and then call the openfromfile method of iworkspacefactory to get a workspace, this is also the embodiment of the factory method in the design model. The open method of the workspace factory returns a normal workspace. Interface Conversion is also required based on the specific data. Because the shapefile is vector data, the workspace interface is redirected to ifeatureworkspace, to read the element classes, this is the same way for the following data formats.
Iworkspacefactory pworkspacefactory;
Pworkspacefactory = new shapefileworkspacefactoryclass ();
Ifeatureworkspace pfeatws;
Pfeatws = pworkspacefactory. openfromfile (@ "D: \ data \", 0) as ifeatureworkspace;
// Open a feature class
Ifeatureclass pfeatureclass = pfeatws. openfeatureclass ("Cities ");

2. Coverage

Coverage is the native data format of ArcInfo Workstation. This format is based on folder storage, because in Windows Resource Manager, its space information and attribute information are stored in two folders respectively. Coverage is a very successful early geographic data model that has been well received by users for more than 20 years. Many of the early data is in the coverage format. ESRI does not disclose the coverage data format, but provides an interchange file (e00) for coverage format conversion, and discloses the data format. However, to promote its third-generation data model Geodatabase, ESRI
The coverage editing function is blocked starting with version 8.3. To use data in the coverage format, you can install ArcInfo Workstation or convert the coverage data to another editable data format. Coverage is a set that can contain one or more element classes. The workspace of coverage data is also its folder. Because coverage can contain multiple element classes, you can use "coverage Name: element class name, for example, "Basin: polygon" in the following code ".
Iworkspacefactory pfactory = new arcinfoworkspacefactoryclass ();
Iworkspace pworkspace = pfactory. openfromfile (@ "D: \ arctutor \ topologydata", 0 );
Ifeatureworkspace pfeatworkspace = pworkspace as ifeatureworkspace;
Ifeatureclass pfeatureclass = pfeatworkspace. openfeatureclass ("Basin: polygon ");

3. Personal Geodatabase

Geodatabase, as the native data format of ArcGIS, reflects the advantages of many third-generation geographic data models. Personal geodatabase is based on Microsoft Access integrated storage space data and attribute data. Enterprise geodatabase is implemented through large-scale relational databases + ArcSDE. As a middleware, ArcSDE converts normal tables in relational databases into spatial objects. The workspace of the personal Geodatabase data refers to the file with the MDB extension. The following code opens the Water element class in Monto. MDB.
Iworkspacefactory pfactory = new accessworkspacefactoryclass ();
Iworkspace pworkspace = pfactory. openfromfile (@ "D: \ arctutor \ Monto. mdb", 0 );
Ifeatureworkspace pfeatworkspace = pworkspace as ifeatureworkspace;
Ifeatureclass pfeatureclass = pfeatworkspace. openfeatureclass ("water ")

4. Enterprise Geodatabase

The workspace corresponding to ArcSDE (Enterprise Geodatabase) is a database connection. When a relational database is an Oracle database, five connection parameters are required: Server, instance, user, password, and version. Server refers to the Host Name of the server, instance refers to the service name or port number, user is the username of the database, password database corresponds to the password of the user, version refers to a version in the enterprise Geodatabase multi-version mechanism, the default version is "SDE. default ", if the relational database is SQL
The database parameter is also required for the connection parameters. The following code opens the controlpoint element class in enterprise Geodatabase. The relational database is Oracle9i.
Iworkspacefactory pworkspacefactory = new sdeworkspacefactoryclass ();
Ipropertyset propset = new propertysetclass ();
Propset. setproperty ("server", "ACTC"); propsetproperty ("instance", "5151 ");
Propset. setproperty ("user", "apdm ");
Propset. setproperty ("password", "apdm ");
Propset. setproperty ("version", "SDE. Default ");
Iworkspace pworkspace = pworkspacefactory. Open (propset, 0 );
Ifeatureworkspace pfeatws = pworkspace as ifeatureworkspace;
Ifeatureclass pfeatureclass = pfeatws. openfeatureclass ("controlpoint ");

5. Tin

Tin, also known as irregular triangle surface, uses a series of irregular triangle points to build the surface. For example, each sampling point has a pair of X, Y coordinates and a surface value (z value). These points are connected by the edges of a group of non-overlapping triangles to form a surface. Tin data is an important data format for spatial analysis and 3D analysis. It is stored on disks as files. The workspace of tin is located in the folder. The following code opens the tin named Mal in the D: \ arctutor \ 3danalyst folder.
Iworkspacefactory pwsfact = new tinworkspacefactoryclass ();
Iworkspace PWS = pwsfact. openfromfile (@ "D: \ arctutor \ 3danalyst \", 0 );
Itinworkspace ptinws = PWS as itinworkspace;
Itin ptin = ptinws. opentin ("Mal ");

6. Raster

Raster data is also an important part of GIS data. The most common file types in ArcGIS include grid, Tiff, and ERDAS image. The workspace of these raster data is also the folder. When you open raster data, you need to use the raster workspace factory, and then use the open raster dataset method of the irasterworkspace interface to open a raster dataset. When you enable the grid dataset, if the data format is ESRI grid, the parameter of the openrasterdataset () method is the name of the grid element set. If the data format is Tiff, the parameter of this method is the complete file name. TIF extension, such as openrasterdataset ("hillshade. TIF "). The following code opens grid-formatted raster data.
Iworkspacefactory rasterworkspacefactory = new rasterworkspacefactoryclass ();
Irasterworkspace rasterworkspace = rasterworkspacefactory. openfromfile (@ "D: \ data \ grid", 0) as irasterworkspace;
Irasterdataset rasterdataset = rasterworkspace. openrasterdataset ("ca_hillshade ")

7. CAD

CAD data can also be directly accessed through ao. The way to access CAD data is similar to coverage, but note that you need to use the CAD workspace factory. Below is a CAD data for opening a DXF, use "CAD file name: Element class name" when opening the element class. Note that the CAD file name must contain the extension. Otherwise, an error is returned. Run the following code to open the polygon element class in buildings. dxf in the d: \ arctutor \ editor \ exercisedata \ editingfeatures folder.
Iworkspacefactory pcadwf = new cadworkspacefactoryclass ();
Iworkspace PWS = pcadwf. openfromfile (@ "D: \ arctutor \ editor \ exercisedata \ editingfeatures", 0 );
Ifeatureworkspace pcadfws = PWS as ifeatureworkspace;
Ifeatureclass pfeatclass = pcadfws. openfeatureclass ("buildings. DXF: polygon ");

Generally, data in a relational table can be directly read through ArcGIS, which greatly facilitates data sharing. For non-spatial data in some businesses, by using OLE, you can easily access data. business data can be stored in various relational databases. The following code accesses the custom table in Microsoft Access, of course, you can also access data in oralce or SQL Server, as long as you change the following connection string (connectstring.
// Create a connection
Ipropertyset ppropset; ppropset = new propertysetclass ();
Ppropset. setproperty ("connectstring", @ "provider = Microsoft. Jet. oledb.4.0; Data Source = E: \ company. mdbl \ ersist Security info = false ");
// Create a new oledb workspace and open it
Iworkspacefactory pworkspacefact;
Ifeatureworkspace pfeatworkspace;
Pworkspacefact = new oledbworkspacefactoryclass ();
Pfeatworkspace = pworkspacefact. Open (ppropset, 0) as ifeatureworkspace;
Itable pttable = pfeatworkspace. OpenTable ("Custom ");

These are the most common data access methods for ArcGIS. when accessing data for GIS analysis, data processing, and spatial visualization, you can add the data to the layer after obtaining the data, you can also search or maintain data.

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: info-contact@alibabacloud.com 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.