SuperMap iMobile 8C(2017) for Android offline data usage instructions

Keywords: REST

Catalog

Making Data 3

1.1 Map Cache Data Making 3

1.2 Map Cache Generation Results 5

Use data 6

2.1 Open cached files in a service manner 6

2.1.1 Step 1: Configure the format of cached data 6

Step 2.1.2: Load data 6

2.2 Open Cache File 8 by Image Plug-in

Making data

This paper mainly introduces the production of map caching data and the use of caching data in two ways: service and image plug-in. The desktop software used to make data is SuperMap
iDesktop 8C(2017).

Map Cache Data Making

Step 1: Double-click to open the map.

Step 2: Click the Map Cache button in the Action group of the Map tab. Open the "Generate Map Cache" dialog box and set the parameters related to the generation of map caches. (8C(2017) version below "Map Cache" button, in the "Start" tab "Cache" group)

Step 3: Set the scale. The application will provide a set of scales by default, and if you don't want to use the default, you can re-enter.

Step 4: Setting basic parameters. Version number is 5.0, partitioning mode is local partitioning, setting the cache name and cache path.

Step 5: Setting range parameters. The cache range and index range use the default map range.

Step 6: Set the storage parameters of the picture. The picture type is
JPG, the storage type of discrete data is "original" and the storage type of compact data is "compact". It is recommended to use compact data with block size of 512*512 pixels.

Step 7: Click on the "Generate" button and wait for the data to be generated. After the generation, there will be prompts in the output window.

Map Cache Generation Results

After the cache generation is completed, the first level folder contains the data folder and sci file, as shown in the following figure:

The second level folder contains a folder named at the set scale and an inf file, as shown in the following figure:

Usage data

Open cached data as a service

It is recommended to open cached files in a service way with fast access speed. You need to configure the data before you use it.

Step 1: Configure data

  • Edit file

Open the sci file and replace the provider with sml: Provider > http://192.168.120.139: 8090/iserver/services/map-changchun/rest/maps/changchun/ sml:Provider>

Before replacement:

After replacement:

Path " http://192.168.120.139: 8090/iserver/services/map-changchun/rest/maps/changchun"

The values of "192.168.120.139:8090" and "changchun" can be set by themselves, but they must correspond to the directory structure of their folders.

In "map-changchun", the "map-" is necessary, and "changchun" can be set by itself, such as "map-nanjing", and it should correspond to its own folder directory structure.

Additionally, other values cannot be modified.

  • Store data

Copy the generated cached data to the device, and the path is ". SuperMap data Rest 192.168.120.139_8090 \ map-changchun \ changchun". Note here that the colon is replaced by an underscore in "192.168.120.139_8090". Since the file name cannot be colon in English, this modification is made. The directory structure is shown in the following figure:


Step 2: Loading data

To open the cached file in a service way, you only need to set the address of the data and the data type (Rest). The key codes are as follows:

m_workSpace = new Workspace();

//Associate map display controls with workspaces

m_mapView = (MapView)findViewById(R.id.Map_view);

m_mapControl = m_mapView.getMapControl();

m_mapControl.getMap().setWorkspace(m_workSpace);

//Cached data path

String server =
"http://192.168.120.139:8090/iserver/services/map-changchun/rest/maps/changchun";

DatasourceConnectionInfo info = new DatasourceConnectionInfo();

//Set Server

info.setServer(server);

//Set the engine type of the data source connection to REST
//Map service engine type info.setEngineType(EngineType.Rest);

//Get a collection of data sources

Datasources datasources = m_workSpace.getDatasources();

//open the data source

Datasource ds = datasources.open(info);

//Add to Map Window
m_mapControl.getMap().getLayers().add(ds.getDatasets().get(0),true);

//Full width display

m_mapControl.getMap().viewEntire();

Open cached data as an image plug-in

To open the cached file as an image plug-in, you need to set the data path and data type (IMAGEPLUGINS). The key codes are as follows:

m_workSpace = new Workspace();

//Associate map display controls with workspaces

m_mapView = (MapView)findViewById(R.id.Map_view);

m_mapControl = m_mapView.getMapControl();

m_mapControl.getMap().setWorkspace(m_workSpace);

//Cached data path

String server = sdcard + "/SampleData/changchun/changchun.sci";

DatasourceConnectionInfo info = **new** DatasourceConnectionInfo();

//Set Server

info.setServer(server);

//Set the engine type of the data source connection to the image read-only engine type

info.setEngineType(EngineType.IMAGEPLUGINS);

//Get a collection of data sources

Datasources datasources = m_workSpace.getDatasources();

//open the data source

Datasource ds = datasources.open(info);

//Add to Map Window
m_mapControl.getMap().getLayers().add(ds.getDatasets().get(0),true);

//Full width display

m_mapControl.getMap().viewEntire();

Posted by bp90210 on Sun, 06 Jan 2019 23:06:09 -0800