Use ArcSDE to build the relationship between geographical elements and tables and publish the element services with relational data tables

Source: Internet
Author: User
Tags silverlight

Some readers in the previous queries hope to provide examples of how to query the associated data table. If you have time today, I will share my complete process. This article will begin with data preparation, create a relationship class between elements and tables, publish the element services with associated tables, and call the client to query associated data.

This article mainly introduces the release of relationship classes and services, and introduces the implementation details of queries in the next section.

First, let's look at an example. This is an example I encountered in my studies and projects. Through this example, we will give a rough description of what is a relational class and what we can use it to do.

We know that a pollution source element may have many element attributes, such as pollution source information, emission port data, and pollutant data, which can be expressed simply:

The basic information of the source contains more information, such as the property code of the source, the type of the source, the emission, the owner, the contact number, and the enterprise scale, as shown in:

The same discharge port also has a lot of content, as shown in:

We can know from the above that a source of pollution has rich information. If we regard a point element as a source of pollution, these should be the attribute of the point element, however, if we add the information one by one to the attribute of a vertex element (as a field of the element), we can see how huge the field of the element is, which seems to be undesirable.

First, if there are too many attributes for a element, the more data is displayed to the user. In this way, you need to set the attributes that are not displayed to the user, because not all data users are visible, not all data needs to be displayed together.

Second, separating the basic attributes of elements from those of the source can improve unnecessary data access. Only when users need to know, SELECT query, this reduces data exposure and resource savings.

Therefore, is there a way to separate some common attributes of the source of pollution (such as longitude and latitude, total emissions, and contact number) from other attributes (such as specific source information, emission port information, and specific pollutant information, when you need to know the basic attributes of a certain source of pollution, it is displayed to the user about the basic attributes of the source of pollution. When the user needs to know the data of the discharge port, it is displayed to the user's discharge port data? The answer is yes. This is what the relationship class can do for us.

For example, we can use common attributes such as longitude and latitude as the attribute of a point element (the attribute of the element itself), and other information into a table, and then associate the table with the element, as shown in:

When the element and Attribute Table are associated, it is equivalent to a source of pollution corresponding to an Attribute Table (1-1 relationship), or a source of pollution corresponds to multiple emission ports (1-m one-to-multiple relationship ). This relationship can be achieved through the link class. For details about the link class, refer to the help document on the ArcGIS official website. This article will introduce how to create a link class of elements, this section describes the relationship between the creation elements and tables.

Since it is the relationship between elements and tables, one element and one table are required first.

The following is a list of elements used in this article (the link class has been constructed ):

This symbol indicates the link class.

The following describes how to build data and relational classes.

1. Connect to the ArcSDE database. In version 10.1, you can directly connect to the geographic database without installing ArcSDE.

2. add a new vertex element in the ArcSDE database (this article is used as an example). In this article, it indicates the vertex element of the pollution source (one in the data list above indicates the river pollution source and one in the air pollution source ), right-click (new)-featureclass (the same operation for table creation ).

Then add the corresponding attributes, as shown in:

Create two tables at the same time: the basic information table of the source of pollution and the basic information table of the source of the emission. The purpose of the two tables is to demonstrate the source of 1-1 (1-1) and 1-M (1-many).

Basic Pollution Source Information table:

Basic information table of the discharge Port:

After the data is created, add the relational class. Select relationship class, just like the process of creating the element above.

Click next:

Associated link type: It indicates that the source and target are mutually independent by default, that is, the source is deleted, the target is not deleted, and the complex expression indicates that the source is deleted, and the target is also deleted, here we choose to make it complex. Because the source of pollution is deleted, the basic information table of the source and the basic information table of the discharge port will also be deleted (instead of deleting the table, the associated data will be deleted ).

Then click Next:

Enter the name and message transmission direction when the source and target point to the source. For details, refer to the help documentation on the official website and click Next:

Select the ing relationship. Even if one-to-one is more than one-to-many, it depends on the actual situation. Here is the relationship between the source and the basic information, so it is a one-to-one relationship, that is, a source of pollution corresponds to a basic information table (the correspondence between the source and the discharge port is one-to-many, because a source of pollution can have multiple discharge ports ). Then click Next:

Whether to add the association property to the link class. Generally, select no. Then click Next,

Set the fields (primary keys and Foreign keys) associated with the source and target. Here we set the pollution source number to the associated fields (the fields associated with the source and target fields must be of the objectid or integer data type, otherwise, results cannot be queried when the web end queries associated data)

Click Next to create the link class. Similarly, the relationship between the duplicate source and the discharge port information table is created.

After creating a table or link class, you must prepare the mxd document to publish the element service with associated data tables. The procedure is as follows:

1. Add the elements and tables in ArcSDE (that is, the pollution source elements and tables created in the above process ).

Right-click a layer and choose add data.

Browse to the database connection, open the geographical database, and select the elements and tables:

Then define the pollution source style:

Save the document and publish the mxd document:

Select feature access in the service parameters to complete the Feature Service Release with associated data tables. Open the GIS service list and you can see the information about the associated data:

Click the atmospheric pollution source to find the relationships content as follows:

In this way, an attribute table can be associated with one element and can be queried and accessed on the Web end by publishing it to the element service. For examples of Web terminals, see the examples on the official website:

Http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryRelatedRecords

Element services with relational data on the official website:

Http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/0

 

The next article will introduce how to query the element link data table on the Web end. Of course, you will probably know the implementation process from the examples on the official website, however, the next article mainly introduces information query and Display Based on the Windows Phone platform. Because Windows Phone does not have dataform and DataGrid controls such as Silverlight, the display of data is not the same as that of Silverlight, at the same time, the content of the next article is also part of my graduation project. You are welcome to continue to pay attention to it.

 

 

 

 

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.