Extended the accessibility of ArcGIS Server on mobile platforms/Internet applications _ Implementation of simple online editing ideas)

Source: Internet
Author: User

Extended the accessibility of ArcGIS Server on mobile platforms/Internet applications

Environment: ArcGIS Server 9.3

The brand-new ArcGIS lelesdk in ArcGIS Server 9.3 has extended the charm of ArcGIS Server to the Windows Mobile platform, filling in the gaps of ArcGIS enterprise-level mobile platform applications; the ArcGIS API forFlex/JS that will be launched later will make heavy makeup in the WebGIS field and bring a good user experience. Undoubtedly, while ArcGIS ServerADF provides comprehensive functions, these sdks and APIs for different platforms, rapid development, and good experience extend the application fields of ArcGIS, shen he and Yi are in harmony with the secret of the enemy.

However, the first appearance of these odd troops is not a little blue. ArcGIS Mobile SDK and WindowsMobile and. net's dead binding limits its application scope. its market share is far greater than that of Windows Mobile's Symbian + iPhone + RIM, which is ignored, the construction and REST of ArcGIS API forFlex have also neglected the submission of spatial data, which is almost intolerable in the later era. The main purpose of this article is to find a new path to make up for these shortcomings and extend the reach of ArcGIS Server so that it can be expanded to the dead corners of various platforms and applications as much as possible.

This article mainly involves two aspects: data acquisition and data submission. In fact, some of my previous articles (http://wu-yongfeng.blogspot.com/) on data acquisition have been elaborated here in short; and on data submission, this article will start from REST, describes in detail how to build a "omnipotent" data submission method through REST and Geoprocessing.

First, let's take a look at the data acquisition. For the powerful service release function of ArcGISServer, it is quite easy to obtain data. For example, if I like kml services, what you need to solve on the (mobile) client or elsewhere is simply a kmz (zip) decompression problem, this solution is available on almost all platforms. Of course, ArcGIS also provides many service types. You can select your preferred type.

For data submission, we recommend that you use a method that is not restricted by the SDK or firewall. Fortunately, the core of ArcGISServer is services. Making full use of these services is the space we can imagine. Here, my method is REST + GeoprocessingService. Next, let me go through this technical process on the Android platform first:

First, write a python script to save Feature to FeatureClass based on parameters:

Import string, OS, sys, locale, arcgisscripting

Gp = arcgisscripting. create ()

Def createPoint (point, x, y ):
Try:
Point. x = x
Point. y = y
Return point
Except t:
Raise Exception, "Create point error ."

Try:
If len (sys. argv) <2:
Raise Exception, "No enough parameters ."

OutputFC = sys. argv [1]
InputString = sys. argv [2]

OutDesc = gp. describe (outputFC)
Shapefield = outDesc. ShapeFieldName
Rows = gp. insertcursor (outputFC)
Pnt = gp. createobject ("point ")

Values = inputString. replace ("\ n", ""). split (",")
Row = rows. newrow ()
Pnt = createPoint (pnt, values [0], values [1])
Row. SetValue (shapefield, pnt)
Row. SetValue ("CaseDetail", values [2])
Rows. insertrow (row)

Del rows
Del row

Except t Exception, ErrorDesc:
If ErrorDesc [0]! = "":
Gp. AddError (str (ErrorDesc ))

Create a Toolbox, add the script and name it AddTrafficCase. Attach two parameters to the script: The FeatureClass to be saved and the passed string (including the coordinate information and the attribute value of a field ). At this time, you can first test whether the function is normal.

Create a Model in the Toolbox that needs to be published as the Geoprocessing service, add this AddTrafficCase script, and define the input parameters (strings) of the Model and the saved FeatureClass,
After the model is built, you can publish it as a Geoprocessing service. For the sake of simplicity, my model does not return a value and only submits a single point of data. Of course, you can make a lot of extensions, so you will never miss it.

Let's open the REST address of the GP service and check whether its function is normal:
Next, I will develop a small Demo on the Map component of Android. You can click to select the current coordinates and input some strings as information to submit them to ArcGIS Server.
For example, on the Android platform, you can enter some text information and use the following rest url to submit user input information:

String detail = editTextCaseDetail. getText (). toString ();
String strURL = "http: // 192.168.200.157/ArcGIS/rest/services/GPService/FeatureService/GPServer/AddTrafficCase/submitJob? String = "+ x +", "+ y +", "+ detail;
Try
{
URL url = new URL (strURL );
HttpURLConnection uc = (HttpURLConnection) url. openConnection ();
Uc. connect ();
Uc. getInputStream ();
}
Catch (Exception e ){}

After connecting to this URL, you can view the relevant database. You can see that the data just submitted has been saved to SDE:

Next let's take another look at this process in ArcGIS API for Flex, which is essentially the same:

Var parms: Object = new Object ();
Parms. String = x + "," + y + ", which is saved by Flex ";

Var geoprocessTask: Geoprocessor = new Geoprocessor ();
GeoprocessTask. url = "http: // 192.168.200.157/ArcGIS/rest/services/GPService/FeatureService/GPServer/AddTrafficCase ";
GeoprocessTask. submitJob (parms );

After the submission is complete, check the result:

From the two examples, we can see that through the combination of REST and GeoprocessingService of ArcGIS Server, we can obtain and submit data on any platform and application that meets the network conditions, it is not limited to the sdks and APIs provided by ArcGIS. That is to say, both mobile platforms, rich Internet applications, and other Internet applications can use this "omnipotent" method for spatial data interaction. We don't have to worry about the only sdks and APIs that ArcGISServer currently provides. I believe NIKE's sentence is: Everything is possible!

 

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.