Principle of ArcGIS for Android offline data editing

Source: Internet
Author: User
ArcGIS for Android offline data editing principles 0 rating/11 read 2012-04-19CSDN

Implementation principle of ArcGIS for Android offline data editing

To edit offline data on ArcGIS for Android, follow these steps:

I. Environment preparation

1. Software Environment

1) ArcGIS Server10 is used to publish the map service.

2) ArcGIS Destop10 is used to cut the cached image.

3) Eclipse3.6.2 + integrated development environment

4) JDK1.6

5) Android SDK

6) Android Development Tools

7) ArcGIS API for Android1.1 plug-in

8) ArcSDE for Oracle11g

9) Oracle11g

2. Prepare the map service

1) After all software environments have been installed, we must first release two editable map services through ArcGIS Server, namely the map service of FeatureServer, the two services are used for online data download and data upload respectively. (When uploading data, you cannot directly upload the data to the actually downloaded service. A review process is required after data editing. Therefore, another service is required for temporary data storage, we can upload the downloaded service after the review is passed)

2) When offline, we also need a cached slice map, which uses ArcCatalog to cut a cached image for offline map display at the device end (the map slice must be compact ).

II. Implementation steps

1. Create a project

Use eclipse to create an ArcGIS for Android project and export the folder of cached images cut through ArcCatalog to your device SD card.

2. Add a map service

Add three map services to the Activity in the project. One is the ArcGISLocalTiledLayer service for offline map display, and the other two are the ArcGISFeatureLayer service for data download and upload; in addition, a GraphicsLayer layer is added to display the queried data.

3. sqlite Database

The sqlite database is used to store offline data, and SQLiteOpenHelper is extended to create databases and tables. When creating tables, the table structure should be basically the same as the table structure used in the FeatureServer service we released (add another mark field to mark the operation status ). In this case, the key lies in the storage of the spatial shape field. sqlite does not have the concept of a spatial field. Therefore, when the data queried by the map service is stored in sqlite, you should customize the format of the inserted data. when entering the local database, we can customize and assemble the data according to the spatial data types: points, lines, and surfaces, for example, Point types can be combined into Point (X, Y) during warehouse receiving. You can parse and assemble the space objects according to this format, after customizing the representation of various spatial data types, it is best to write a tool class that is responsible for parsing and assembling data formats (because the Demo I Want To Do only involves vertex data, there is no shape field in the database table, the X and Y fields are added to store the coordinate information ).

4. Data Editing

When editing data, we can edit the data in two aspects: attribute editing and space editing.

When we query data through ArcGISFeatureLayer and insert sqlite data through our custom data format, we can perform offline data operations.

1) EDIT attributes

Attribute Modification is nothing more than modifying the attributes in the Graphic object. Graphic cannot add event listening. Therefore, adding a click event like a button does not pop up the relevant information of this element, we can use GraphicsLayer'sGetGraphicIDs(float x, float y,int tolerance)To obtain the attributes of elements and their elements,Sadly, Graphic does not provide an interface for modifying attributes. You can only create a new Graphic object and add the updated attributes in its constructor or use GraphicsLayer'supdateGraphic(int id, Map<String,Object> attributes)To update the attributes of Graphic.And update the modified element attributes to the local sqlite database and the status of the mark field in the modification table.

2) Space editing

For a Graphic object, we can not only change its attributes, but also modify its spatial location information. The changes to points, lines, and surfaces are slightly different.

You can directly update the Geometry of Graphic when you click Modify. However, Graphic does not provide an interface to modify the Geometry.UpdateGraphic(int id, Geometry geometry)Method to update its space location.

The spatial location change of the line and plane mainly refers to the location change of the line or plane node. We can click a node on the line or plane to drag and use GeometryEngine. getNearestVertex () can be used to obtain the vertex we clicked, closest to the node of the ry, and return a Proximity2DResult object. Through this object, we can obtain the Index position of this node, and then through the line or plane objectSetPoint(int index, Point point)Method to update the node, then our graphics can be changed, and the updated Graphic space object will be re-parsed into a defined format for receiving the databaseAnd modify the status of the mark field in the table

5.  Data submission

In the above steps, the offline data editing function is basically complete. Finally, when we are online, we only needArcGISFeatureLayer submits data to the temporary table for review.

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.