In the original: share my part bi content: Source management application based on Windows Phone platform
Graduation six months, and summed up the previous work, found a lot of knowledge not to review all forgotten. Recent news has always reported Beijing's air pollution, a variety of fog and haze, a variety of PM X exceeded, and then thought we have food to eat (I am also an environmental trained, undergraduate environmental science major), and then contact the graduation thesis, just do is the air pollution related, so busy to share with you, is also a summary of their previous work.
The paper mainly does a Web-based and Windows Phone platform for pollution prediction and source management applications, the general function is based on the pollutant diffusion model, the diffusion of air pollution, concentration distribution simulation and visual expression, while the emission of pollutants from the source of online management and monitoring.
Here to share my windows Phone part of the completion of the content, the main realization is the management of pollution sources, such as the source of information on the deletion and modification. Cut the crap and get to the point below:
The main content of this time is roughly the following parts:
1.GIS Service section, how to build a GIS service environment, such as publishing a feature service with relationship classes, and its considerations
2.ArcGIS API for data binding in Windows phone, such as the display of feature information.
3.ArcGIS API for the management of feature information in Windows phone (add features, delete features, edit feature attributes, query properties)
How to query the data tables of feature associations in the 4.ArcGIS API for Windows phone (non-feature itself)
First look at the final effect:
Main interface, and query page
Feature information displays:
Click and multi-Query the source details and drain information
To add or Remove Features:
The above content is generally done, including GPS positioning and navigation, etc., because it is a simulator, so it is impossible to achieve the function of positioning. There will be no more words here.
ArcGIS API for Windows Phone geo-feature attribute editing
The main function is to realize the mobile intelligent terminal to the source data access and query. The Chinese map provided by ArcGIS Online in China is used as a basemap for this program, and the source data layer is loaded on the basemap. The data layer type for the source should be featurelayer, and its URL address should point to the geographic feature resource in the Featureservice published by ArcGIS Server. The following example code declares a featurelayer layer:
< Esri:featurelayer ID = "Converntionalsourcelayer" URL = "HTTP://QZJ-PC/ARCGIS/REST/SERVICES/POLLUTIONSOURCEINFO/FEATURESERVER/1" AutoSave = "True" outfields ="*" MouseLeftButtonDown = "Featurelayer_mouseleftbuttondown" />
In the ArcGIS API for Windows Phone, you can complete the editing of features through the editor component. Editor-edited object requirements are feature resources in Featureservice.
An editor is declared as follows:
< Esri:editor x:key = "Myeditor" Layerids = "Converntionalsourcelayer" Geometryserviceurl = "Http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" editcompleted = "editor_editcompleted" />
The editor component contains the following editing commands:
Feature name |
Function description |
Add |
Draw and add a graphic |
Cancelactive |
Cancels all active actions in the Edit feature |
ClearSelection |
Deselect All selected graphic |
deleteselected |
Deletes a graphic, and if this graphic is associated with an editable Featurelayer, the graphic is also removed from the Geodatabase |
Cut |
Clip a graphic through a geometry service |
Editvertices |
Edit the vertex of the graphic, which is for the editing of the changeable features |
Reshape |
Redraw the shape of a selected graphic by geometry service |
Save |
Save all editing operations |
Union |
Connect all selected graphic through the geometry service |
Select |
Select a graphic |
Each command in the editor contains two methods, one is CanExecute, the other is the Execute method, the previous method is used to determine whether the command can be executed, and when the confirmation can be executed, it begins to perform the operation. For example, for the Add command, the sample code is as follows:
if (Editor. Add.canexecute ("conventionalsource")) editor. Add.execute ("conventionalsource");
The arguments in the CanExecute and execute functions here are the name of the specific template in the editing layer or the ID value of the type. Figure 5.15 shows the Templates property in the feature service layer.
The other actions are similar to the add operation, where different input parameters for the function are not the same, and are therefore no longer described here.
The next step is to view and edit the layer's information through the editing tools after creating the edited layer and declaring the editing tool. Shows the process by which a mobile terminal accesses related features in a geodatabase.
The core of accessing and editing is GIS service, and all the operation is done by GIS service, in which GIS service includes common featureservice,geometryservice,mapservice and so on.
Describes the process of mobile terminal access and the operating interface on Windows Phone phones.
After setting up the Edior tool, this article also defines a ListBox control that binds the attributes of the source to the contents of the ListBox, so that when the contents of the ListBox are modified, the properties of the source are changed and the changes are updated to the database in the background. So as to achieve the effect of editing the source attribute. In addition to the previous Add method and delete method, by adding or removing a source of pollution, it is very good to complete the source data editing and data submission functions. The final example is as follows:
Second , the ArcGIS API for Windows Phone geographic feature attribute query
In this article, we provide two kinds of query methods, one is query by attribute and one is spatial query. The rationale for both queries is consistent. The procedure and principle of its query is consistent with the ArcGIS API for Silverlight. is to implement the function of query through Querytask.
For a property query, given the property criteria of the query, for example, we only query the source of pollutant emissions greater than 100kg, then simply set the query's where property.
Query. Where="ps_pollutionq >100"; querytask.executeasync (query);
For a spatial query, it is actually by setting the Geometry property of query. The user-drawn graph is captured by a draw event, which is then assigned to the geometry of query and the last query executed, as shown in the following code:
Spatialquery.geometry = E.geometry;querytask.executeasync (spatialquery);
Shows query by attribute criteria and query by space:
Third,ArcGIS API for Windows Phone Geographic Feature Association property sheet Query
The same is true of Silverlight in the associated property sheet query, which is done by specifying relationshipparameter, such as the one declared below Relationshipparameter:
Relationshipparameter relationshipparameters =NewRelationshipparameter () {//querying associated data with the source_id field//It is important to note that the field used for the query must be of type integer (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 };//Usertoken is specified as the associated ID value, which can be used to judge the result of the query as the tableQuerytask.executerelationshipqueryasync (RELATIONSHIPPARAMETERS,_RELATIONSHIPID);
Finally, you can query the associated data information, and finally:
PS: Code upload for a long time no success, egg Pain Campus Network Ah, there is a need for code to leave a message .... I will send the code and test data to your mailbox, about the publishing of the GIS service, see the previous Series blog post, welcome to my blog ..... Your support is my motivation to persevere.