Share some of my work: pollution source management applications based on Windows Phone platform

Source: Internet
Author: User

After half a year of graduation, I summarized my previous work and found that I forgot a lot of my knowledge. Recent news have always reported Beijing's air pollution, various smog, and various PM x standards. Then, we thought we would have had a meal later (I am also an environmental specialist, bachelor's degree in Environmental Science), and then I contacted my undergraduate graduation thesis about air pollution, it is also a summary of your previous work.

This paper focuses on the application of pollution prediction and Pollution Source Management Based on Web and Windows Phone platforms. The general function is to spread air pollution according to the diffusion model of pollutants, the concentration distribution is simulated and visualized, and the pollution sources of discharged pollutants are managed and monitored online.

Here we will share with you the configuration of my Windows Phone, which mainly implements the management of pollution sources, such as the addition, deletion, modification, and query of pollution source information. To put it bluntly, let's start with the question:

The main content of this article is roughly as follows:

1. How to set up the GIS service environment, such as the deployment of element services with a relationship, and precautions

2. ArcGIS API for Data Binding in Windows Phone, such as displaying element information.

3. ArcGIS API for managing element Information in Windows Phone (adding elements, deleting elements, editing element attributes, and querying attributes)

4. How to query data tables associated with elements in ArcGIS API for Windows Phone (non-elements themselves)

First, let's take a look at the final effect:

Main Interface and query page

Element Information Display:

Click to view more pollution source details and discharge port information

Add or delete elements:

 

The above content is roughly done by the design, which also includes GPS positioning and navigation. Because it is a simulator, the positioning function cannot be implemented. I will not talk more here.

1. Edit geographical element attributes of ArcGIS API for Windows Phone

The main function is to access and query the pollution source data of mobile smart terminals. The Chinese map provided by ArcGIS online in China is used as the basemap of this program, and the source data layer is loaded on the basemap. The source data layer type should be featurelayer, and its URL should point to the geographical element resources in featureservice released by ArcGIS Server. The following Sample Code declares a featurelayer layer:

<esri:FeatureLayerID="ConverntionalSourceLayer" Url="http://qzj-pc/ArcGIS/rest/services/PollutionSourceInfo/FeatureServer/1"AutoSave="True"OutFields="*" MouseLeftButtonDown="FeatureLayer_MouseLeftButtonDown" />

In ArcGIS API for Windows Phone, you can use the editor component to edit elements. The edited object of editor must be the element resource in featureservice.

An editor is declared as follows:

<esri:Editorx:Key="MyEditor"LayerIDs="ConverntionalSourceLayer"GeometryServiceUrl="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" EditCompleted="Editor_EditCompleted"/>

The editor component contains the following edit commands:

Function Name Function Description
Add Draw and add a graphic
Cancelactive Cancel all the operations activated in the editing function
Clearselection Deselect all selected graphic
Deleteselected Delete a graphic. If this graphic is associated with an editable featurelayer, the graphic is also deleted from the geographical database.
Cut Editing a graphic through a geometry Service
Editvertices Edit the vertex of graphic.
Reshape Redraw the shape of a selected graphic through geometry Service
Save Save all edit operations
Union Connect all selected graphic through geometry Service
Select Select a graphic

Each command in the Editor contains two methods: canexecute and execute. The previous method is used to determine whether the command can be executed. When it is confirmed that the command can be executed, then begin to perform the relevant operations. For example, for the Add command, the sample code is as follows:

if (editor.Add.CanExecute("ConventionalSource"))editor.Add.Execute("ConventionalSource");

Here, the parameters in canexecute and execute functions are the names or types of special templates in the editing layer. Figure 5.15 shows the templates attribute in the element service layer.

Other operations are similar to adding operations. The input parameters of functions are different, so they are not described here.
After the editing layers and the editing tool are created, the next step is to view and edit the information of the layers through the editing tool. Shows the process of accessing the relevant elements of the geographical database from a mobile terminal.
The core of access and editing is the GIS service. All operations are completed through the GIS service. The GIS service includes the commonly used featureservice, geometryservice, and mapservice.
This section describes the access process of mobile terminals and the operation interface on Windows Phone.

After setting the edior tool, this article also defines a ListBox control to bind the property of the pollution source to the content of ListBox, so that when you modify the content of ListBox, at the same time, the property of the source will be changed, and the changes will be updated to the back-end database to achieve the effect of editing the source property. In addition, you can add or delete a pollution source by combining the add method and the delete method, so that you can edit the pollution source data and submit the data. The final result is as follows:

 

IIQuery geographical element attributes of ArcGIS API for Windows Phone

This article provides two query methods: query by attribute and query by space. The basic principles of the two queries are the same. The query process and principle are consistent with those of ArcGIS API for Silverlight. All query functions are implemented through querytask.
For attribute query, the query attribute conditions are given. For example, if we only query pollution sources with pollutant emissions greater than 100kg, you only need to set the where attribute of the query.

query.Where="PS_PollutionQ >100";queryTask.ExecuteAsync(query);

For spatial queries, you can set the geometry attribute of the query. First, capture the drawing drawn by the user through a draw event, assign the drawing to the query geometry, and finally execute the query. The Code is as follows:

SpatialQuery.Geometry = e.Geometry;queryTask.ExecuteAsync(SpatialQuery);

Query by attribute conditions and by space are displayed:

 

III,Query the geographical element association Attribute Table of ArcGIS API for Windows Phone

In the query of association attribute tables, the query is similar to that of Silverlight by specifying relationshipparameter. For example, a relationshipparameter declared below:

 

 

Relationshipparameter relationshipparameters = new relationshipparameter () {// use the source_id field to query the associated data. // note that the field used for query must be of the integer type (the string type will not query the result) objectids = new int [] {convert. toint32 (_ selectedgraphic. attributes ["source_id"])}, relationshipid = _ relationshipid, outfields = outfildes, outspatialreference = basemap. spatialreference, returngeometry = true}; // specify usertoken as the associated id value, so that the query result can be determined by the querytask table. executerelationshipqueryasync (relationshipparameters, _ relationshipid );

 

Finally, you can query the associated data information. The last one is:

 

 

 

PS: the Code has not been successfully uploaded for a long time. If you need code, you can leave a message .... I will send the code and test data to your mailbox. For more information about the GIS service release, see the previous blog series. Welcome to my blog ..... your support is my persistent motivation.

 

 

 

Related Article

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.