Category: Mobile

ArcGIS API for iOS v1.8 Beta is live!

The iOS development team has just released an open, public beta for the next release of the ArcGIS API for iOS. It is available for download from our beta community site now! Sign up for the ArcGIS Beta Community at http://betacommunity.esri.com and click on the “ArcGIS API for iOS” link to join!

The 1.8 beta release builds upon the success of our 1.0 release and introduces the following new capabilities:

  • a Sketch layer to easily create and edit geometries
  • a magnifier for the map
  • a high-performance, native, Geometry Engine to perform sophisticated geometric operations locally on the device
  • support for web maps
  • a new Route Task to generate point-to-point routes and driving directions using Network Analyst services.
  • support for map to wrap around the dateline
  • enhanced callout customization including the ability to display custom views in the callout
  • much more…

We are looking forward to having you join our beta program and more importantly using the ArcGIS API to build new and exciting applications for the iPhone, iPad, and iPod Touch devices!

Mobile Team

Posted in Mobile | Tagged , , , , , | 1 Comment

The ArcGIS API for Android Beta Program is now Open!

We are excited to announce that the ArcGIS API for Android is in public beta and available for download…. more details.

Posted in Mobile | Tagged , | Leave a comment

New Training Courses Available

Thanks to the hard work of Kris Bezdecny and Violet Michniuk from our Education Services team, there are two new web training courses that will guide you through the process of creating maps for use with iOS and Windows Phone devices as well as a targeted course on how to use the ArcGIS application on your iOS device:

Creating Web Maps for Lightweight Mobile Apps

This course guides you through the process of creating operational maps and services that exploit the query and editing capabilities of our lightweight mobile applications as well as how to publish web maps using ArcGIS Online.

Using the ArcGIS for iOS Application

Following the course on how to create web maps, this course focuses on the feature functionality of the ArcGIS application. You will learn how to access web maps, search for map data, collect and edit data and attach media to what you collect.

Posted in Mobile | Tagged , , , , , , | Leave a comment

Developing a custom tiled layer

Introduction

ArcGIS API for iOS provides a number of predefined layers that work with GIS Servers such as ArcGIS Server, Bing Maps, etc. These layers retrieve map images from the GIS Server and display them on a map. Layers can be broadly categorized into two types – Dynamic layers and Tiled layers. Dynamic layers display maps using images that are generated on the fly. Tiled layers display maps using pre-generated map images, also known as tiles. These tiles are usually hosted on a server and can be accessed via a URL. The format for the URL depends upon the tiling scheme used by the provider to organize the tiles. 

The API also provides an extensible framework that allows you to develop your own custom layers. In this post, we will focus on developing a custom tiled layer. Instead of accessing tiles from a server, our layer will use tiles that are bundled with the application. For the sake of brevity, we will only discuss the high-level aspects of creating the layer. The full implementation of the layer is available as a sample.

Map Cache

To use the custom layer, a map cache needs to be embedded in the application bundle.

A map cache contains map images. These images are organized within folders representing Levels and Rows. The name of the image files represent Columns. Names for Level folders begin with the letter ‘L’ followed by a number in decimal format. Names for Row folders and Column images begin with a letter (R for row, and C for column) followed by a number in hexadecimal format. For example, Level 11 is represented by L11 and Row 11 by R0000000b. The cache also contains two XML files – conf.xml and conf.cdi. These files contain metadata about the cache such as the tiling scheme and the full extent.

Note, if your cache was generated with a 9.3.1 ArcGIS Server or older, it may not contain the conf.cdi file. You need to upgrade the service to ArcGIS Server 10. This will automatically create the file for your existing cache.

Also note, ArcGIS Server 10 supports two cache formats – Compact and Exploded. The custom layer discussed in this post only works with exploded cache format.

When you include a cache in your application, be sure to include the entire folder hierarchy of the cache, starting with the top-level folder. The top-level folder usually has a name beginning with “cache_”. The top-level folder contains a folder whose name matches the data frame in the map document which was used to create the cache. The data frame folder usually contains a folder called “_alllayers” In the example shown, “cache_World” is the top-level folder and “Layers” is the data frame folder.

To add a cache to your application, right-click on the Other Sources group in your XCode project, choose Add > Existing Files. Navigate to the top-level map cache folder. Enable Copy items into destination group’s folder, and select the Create folder references for any added folders option. Click Add to finish.

Note: If you have large number of tiles, it may take a lot of time to copy them into the project directory. To avoid this delay, you can disable the Copy items into destination group’s folder option when adding the cache to your application. By doing this, the cache will still get included in your application bundle, but XCode will skip copying it to your project directory. 

Map caches can be quite large depending upon factors such as the extent and scale levels of the cache. The size of your application could increase dramatically by including the cache. iOS applications can be as large as 2GB but the application must be under 20MB to allow over-the-air downloads. See the ITunes Connect Developer Guide for more information.

Design

All tiled layers in ArcGIS API for iOS extend from the AGSTiledLayer class. This class in-turn extends from AGSLayer. AGSTiledLayer and AGSLayer provide a lot of supporting infrastructure for implementing tiled layers. By inheriting from these classes, we can focus exclusively on the aspects that are unique to our layer. We don’t need to worry about, for instance, positioning tiles correctly on the map, or scaling tiles in response to a pinch. All we need to do is provide some metadata about the layer and implement the mechanism for retrieving tiles.

To create our custom layer OfflineTiledLayer, we too will extend  from AGSTiledLayer.

@interface OfflineTiledLayer : AGSTiledLayer  {
   
}

Any layer that extends AGSTiledLayer must provide information about its tiling scheme and implement the mechanics to retrieve tiles. The tiling scheme is used by the map to calculate which tiles fit within the map’s bounds.  The map then requests the layer to fetch those specific tiles that need to be displayed.

@implementation OfflineTiledLayer 

 -(
AGSTileInfo*) tileInfo { //todo } 
 -(NSOperation<AGSTileOperation>*)retrieveImageAsyncForTile:(AGSTile*) tile   {
 
  //todo }
 … 
@end

By virtue of extending AGSTiledLayer, a layer also indirectly extends AGSLayer. The layer needs to provide some basic information such as it’s fullEnvelope, initialEnvelope, spatialReference, and units. AGSLayer defines read-only properties for these parameters. Our custom layer implements getter methods for these properties -

@implementation OfflineTiledLayer
 

 -(AGSUnits) units { //todo  }
 -(AGSSpatialReference*) spatialReference { //todo } 
 
-(AGSEnvelope*) fullEnvelope { //todo } 
 
-(AGSEnvelope*) initialEnvelope { //todo } 
@end

Finally, our layer defines an initialization method that requires a path to the data frame folder in the cache. The method also accepts a reference to an error object so that it can return an error if problems are encountered while reading the cache.

@interface OfflineTiledLayer : AGSTiledLayer  {
  - (id)initWithDataFramePath:(NSString*)path error:(NSError**)outError;  
}

Implementation

The following diagram provides an overview of how the OfflineTiledLayer works. To cleanly separate responsibility, the layer uses a dedicated class called OfflineCacheParserDelegate to parse the XML files in the cache. To actually retrieve tiles from the cache, the layer uses objects of an OfflineTileOperation class.

The bulk of the work is done during layer initialization. This is when the layer uses OfflineCacheParserDelegate to parse metadata in the conf.xml and conf.cdi XML files. These files contain information about the layer’s tiling scheme and extent respectively.

- (id)initWithDataFramePath: (NSString *)path error:(NSError**)outError {
 
 OfflineCacheParserDelegate* parserDelegate = [[OfflineCacheParserDelegate alloc]  
    init
];
 //Parse the conf.cdi file 
 NSString* confCDI = [[NSBundle mainBundle] pathForResource:@”conf”
                                                    
ofType:@”cdi”
                                               
inDirectory:_dataFramePath];
 NSXMLParser* xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL       
                                                     fileURLWithPath
:confCDI]]; 
 
[xmlParser
setDelegate:parserDelegate];
 [xmlParser parse]; 
 
[xmlParser
release];   

 //Parse the conf.xml file
 NSString* confXML = [[NSBundle mainBundle] pathForResource:@”conf” 
    
ofType:@”xml” 
   
inDirectory: _dataFramePath]; 
 
xmlParser = [[
NSXMLParser alloc] initWithContentsOfURL:[NSURL 
                                         
fileURLWithPath:confXML]]; 
 
[xmlParser
setDelegate:parserDelegate];
 [xmlParser parse]; 
 
[xmlParser
release]; 
 

}

OfflineCacheParserDelegate decodes the information and makes it available as AGSTileInfo and AGSEnvelope objects. The layer then uses these objects for implementing the properties defined in AGSLayer and AGSTiledLayer. Finally, the layer indicates it is loaded by invoking the layerDidLoad method.

- (id)initWithDataFramePath: (NSString *)path error:(NSError**)outError {
 
  _tileInfo = [[parserDelegate tileInfo] retain];
  _fullEnvelope = [[parserDelegate fullEnvelope] retain];
  [self layerDidLoad]; 
 

} 

- (
AGSTileInfo*) tileInfo {  return _tileInfo; } 
- (AGSEnvelope*) fullEnvelope { return _fullEnvelope; } 

When the layer is added to the map, the map requests for tiles that need to be displayed within the map’s bounds. For each tile, the map invokes the layer’s retrieveImageAsyncForTile: method. To improve performance, tiled layers use an operation queue for retrieving tiles. This operation queue is provided by the parent AGSTiledLayer. The queue allows multiple tiles to be retrieved concurrently in the background. A tiled layer creates an operation object for every tile that needs to be fetched and adds it to the queue. The queue then runs these operations and removes them when they finish executing. Operation objects used by tiled layers must conform to the AGSTileOperation protocol.

OfflineTiledLayer uses a custom class, OfflineTileOperation, to retrieve tiles from the local cache. The operation object is given information about which tile to retrieve, the path to the local cache, and a target-action pair representing the method to invoke when the operation finishes.

- (NSOperation<AGSTileOperation&gt
;*) retrieveImageAsyncForTile: (
AGSTile*) tile {  
 
 //Start an operation to fetch the tile   
 OfflineTileOperation
*operation = [[OfflineTileOperation alloc] initWithTile:tile
                                      dataFramePath:_dataFramePath 
                                             
target:self 
                                             action:@selector(didFinishOperation :) ];
  [super.operationQueue addOperation :o peration];
  return [operation autorelease];
}

When the operation finishes, it invokes the didFinishOperation: method on the layer. The layer then checks to see whether the operation found a tile image or not. It then appropriately notifies the tileDelegate. The tileDelegate ensures that the tile is correctly displayed on the map.

- (void) didFinishOperation:(NSOperation<AGSTileOperation>*)op { 
  //Check if a tile was found…
 
if
(op.tile.image!=nil) {
     //… inform the delegate of success 
 
  
   [self.tileDelegate tiledLayer:self operationDidGetTile :o p]; 
  
}
else {
     //… inform the delegate of failure 
 
    [self.tileDelegate tiledLayer:self operationDidFailToGetTile :o p]; 
 
}
}

Summary

In this post we saw how to develop a custom tiled layer that reads tiles from a map cache embedded within the application. To use the layer with your own data, you need to publish the data as a map service on ArcGIS Server and then create a cache for the service. You can then copy the cache over to your development machine and include it in your iOS application.

Once the cache and the custom layer are included in your application, all you need to do is instantiate the layer with a path to your cache’s data frame folder and then add the layer to the map -

NSError *err;
NSString *dataFramePath = @”cache_World/Layers”; //Path to your cache 
OfflineTiledLayer *tiledLayer = [[OfflineTiledLayer alloc] initWithDataFramePath:
     dataFramePath
error: &err];



UIView
*tiledLayerView = [self.mapView addMapLayer:tiledLayer withName:@"Custom Tiled Layer"]; 

Contributed by Divesh Goyal of the ArcGIS for iOS Development Team

 

Posted in Mobile | Tagged , , | Leave a comment

ArcGIS for iOS Application v1.5 Released!

The Mobile team has released a new update for the ArcGIS application and it is available now on Apple’s App Store for you to download and use.

Version 1.5 of the ArcGIS application includes the following enhancements:

Data Collection and Editing

  • Now you can use GPS or the map to collect and update GIS data (points, lines and polygons).
  • Attach photos and movies to what you collect.
  • Enter attribute details using intelligent forms that are driven by ArcGIS data models (domain-driven pick lists, date controls, etc).
  • Includes a set of hosted industry specific sample maps that serve as a data collection playground. To find them within the application, look inside of the new Gallery entry on the Find Maps tab.

Tap on Map Identify

  • We have simplified the experience of identifying locations on the map. A simple tap on the map replaces the Identify Location tool.

Magnify your Identify and Editing experience

  • When interacting with the map, you can be more precise in where you tap by holding your finger on the map and using a Magnifier to place a vertex when collecting a feature or a pin when identifying a feature.

Streamlined ArcGIS Online account creation

  • We have streamlined the way that you create an ArcGIS Online account. Now you can create your account directly within the ArcGIS application by entering basic account details.
Posted in Mobile | Leave a comment

Using the ArcGIS API for iOS Samples

As most of you already know, we provide a number of samples for ArcGIS API for iOS under the iOS Developer Samples group on www.arcgis.com. These samples showcase the functionality of the API and also to help you get started developing applications of your own. Be sure to check the group regularly for updates and new additions, and also send us your ideas about which samples you would like to see.

Some of you have complained about not being able build and run the samples. In this post, I will provide a couple of tricks that could help you troublshoot problems with the samples, and also point you to key Apple resources for more information about the iOS Development environment.

Eash sample is provided as a zip file. The zip file contains an entire XCode project including the source code, graphics, and XCode-specific project files. The project files store many common build settings such as the frameworks and libraries to link to, the SDK to use, the targets to build, and so on.

Most commonly when a sample doesn’t build properly, the Overview Toolbar menu will display Base SDK Missing. This means the project is trying to reference an iOS SDK that is not available on your machine. This might happen, for instance, if you installed a more recent version of the iOS SDK than what was used to create the sample. When we create samples, we use the most recent version of the iOS SDK available at the time. Thus, when created samples for version 1.0 of the API, we used iOS 4.0 SDK to create the samples. Information about the SDK being used is stored in the project files. Shortly thereafter, Apple released iOS 4.1, and more recently, 4.2 SDKs. If you have these SDKs installed on your machine instead, you will experience the problem described above because the sample will try to unsuccessfully reference the previous version of the SDK.

To fix the problem, you need update the Base SDK. You do this by double-clicking the project’s Target to bring up the Info window. Then, under the Build settings pane, update the Base SDK property.

One thing to consider when you’re making changes to a Target, is to make sure you are modifying the correct configuration. A target has 2 configurations by default – Release and Debug. These configurations are used to build the Release and Debug versions of your application respectively. Some settings, such as the Base SDK, typically use the same values for both configurations. When you modify such settings, remember to modify the settings for each configuration. You can do this either by modifying each configuration separately, or by modifying both configurations simeltaneously by selecting the All Configurations option.

Another common reason why a sample may not run is if the project is configured to run the sample on a device. In such cases, you can expect to encounter the following error –

The simplest way to run a sample, is to run it on the simulator. You can do this by choosing the Simulator option in the Overview toolbar menu.

If you really do want to run on a device, you will need to do a few things –

1. You will need to have a valid Development Certificate from Apple. This certificate needs to be installed on your development machine.

2. You will also need to create a Development Provisioning Profile from the iOS Provisioning Portal and install it on your development machine and each iOS device you intend to use. A provisioning profile is used to authorize an application (specified by an App ID) created by a developer (specified by a developer certificate) to run on a device (specified by device IDs). You can find more information about this process in the Managing Devices and Digital Identities section of the iOS Development Guide and also in the iOS Developer Program User Guide (Note, you will need to sign in with your Apple ID to access the User Guide).

You will also need to make a few changes to the project -

3. You will need to modify the sample’s *-Info.plist file under the Resources group. In this file, you will need to modify the Bundle Identifier property and replace the “com.yourcompany” text with the App ID used in your provisioning profile.

4.You will need to digitially sign the application. Open the Target’s build settings, scroll down to the Code Signing Identify section, and choose your provisioning profile to digitally sign the application.

 Apple’s Technical Note TN2250 has more information about the Code Signing process. 

Once you’ve completed these steps, ensure your device is connected to your development machine, then build and run the project. The sample application should automatically get installed and launched on your device.

 

Posted in Mobile | Leave a comment

Checksum Revisited

After the release of 9.3.1 we wrote a blog article titled Checksum Explained. Checksum is a “handshake” between the mobile client and ArcGIS Server. It happens every time the client attempts to synchronize the contents of its local client cache with the mobile service that serves as its parent.

We have received considerable feedback from this article and the Checksum process at the 9.3.1 release. A lot of you have encountered a “Checksum error” when synchronizing data and not understood why and/or what properties of the map can trigger the error.

For the 10.0 release, we improved the Checksum process considerably and this article lists specific map properties that are evaluated during the handshake. However, if you need to change the published map, it is critical that you plan for this and synchronize then delete all local caches before making any changes to the service that could generate a Checksum Error.

Map/Data Frame Properties

The Mobile Service is a Server Object Extension of a Map Service. As such, map properties are defined based upon the data frame that was published as a map service. This may or may not be the active data frame in your map document.

The following properties of the map/data frame are calculated:

  • Full Extent – it is required for publishing at 10.0 that you set a custom full extent for the data frame. This will ensure that the Full Extent does not change. However if you need to alter the extent it will cause a checksum error.
  • Spatial Reference – changing the map projection will cause errors.
  • Layer Count – number of layers within the map published.
  • Workspace Count – number of workspaces in the map

Map Layers

The following properties of map layers are calculated:

  • Layer Type – Primary type for each map layer (Feature, Raster, Annotation)
  • Layer Name – Name within the map. Often the feature class name unless altered in ArcMap.
  • Layer Index – Order of the layers in the map
  • Datasource – the workspace ID, dataset name, version type, version name, editing level (read-only for example)
  • Raster Width/Height – for raster layers

Feature Classes

For each layer, the following properties of its associated feature class are calculated:

  • Shape Type – the geometry type of the feature class (point, line, polygon, annotation)
  • Shape Field Name – name of the Shape field of the feature class
  • OID Field Name – name of the field assigned as OID or FID
  • Field Count – number of fields on the feature class
  • Field Name – name of the field (not the alias)
  • Field Length – length of the field
  • Field Flag – a byte representing field attributes (data type, editable, nullable)
Posted in Mobile | Tagged , , , | Leave a comment

ArcGIS Mobile 10 Code Samples

The Mobile Development Team has created a new group inside of ArcGIS.com to host code samples that you can download and use. The group is called ArcGIS Mobile Code Samples and with our initial upload it includes the following samples:

  • Customized Data Collection – this is a custom task that extends the data collection workflow for the Windows Mobile application. Using this sample you can treat the collection of the shape of a feature as if it is another attribute you want to collect.
  • Picasa – this sample illustrates how you can use the core ArcGIS Mobile SDK and the Picasa API to capture and upload photos and videos.
  • Rangefinder – this sample augments the ArcGIS Mobile applications’ data collection workflow so that you can use a laser range finder to collect the location features.
  • Routing – using the ArcGIS Online routing service you can route to a GIS feature from your current location and get driving directions.
  • Waypoint Navigation – being able to navigate “as the crow flies” is a useful tool when working in the field. This sample illustrates how you can navigate to a feature from your current location using a bearing and distance.
  • Show XY – displays your current LAT/LONG position that is fed from the GPS receiver in your device on top of the map.
  • Save User ID – this sample illustrates how you can use your current user id (associated with the field crew task) to auto-populate an attribute value for a given field.

Please bookmark our group in ArcGIS.com and check back frequently as you will see many more samples coming soon.

Thanks,

Mobile Team

Posted in Mobile | Tagged , , , , , , | Leave a comment

ArcGIS Mobile and ArcGIS Desktop

You may have noticed when logging into the Customer Care Portal that you see ArcGIS Mobile available for download in more than one location (both ArcGIS Desktop and ArcGIS Server). That is because it is now licensed for use with both ArcGIS Desktop and ArcGIS Server! If you have an ArcView license, you can use ArcGIS Mobile to view your maps as well as collect and update GIS data!

In support of this license change, the Mobile team has uploaded a video on our resource center video gallery to guide you through the process of using ArcGIS Mobile with ArcGIS Desktop. We have also uploaded 2 additional videos on how to Create A Mobile Project and How to Use the Mobile Project Center.

To fully support the ability to use ArcView with ArcGIS Mobile, we had to update both ArcGIS Mobile and ArcGIS Desktop so there are two critical updates that you need to download if ArcView is the license that you plan to use:

  1. A general patch to ArcGIS Desktop that supports creating a Global ID column to a feature class (required for field editing)
  2. The latest software update (build 2475) of ArcGIS Mobile that is available through the Customer Care Portal (resolves a licensing restriction with the Create Mobile Map and Synchronize Geoprocessing Tools).

For more details on the licensing change, please visit the products page on our corporate web site for details.

Mobile Team

 

 

Posted in Mobile | Tagged , , , , | Leave a comment

ArcGIS Mobile Update on Customer Care Portal

If you log into the ESRI Customer Care Portal, you will find that we have updated the download for ArcGIS Mobile. It is now titled “ArcGIS Mobile 10 (Build 2475)”. This is a quick bug fix update to ArcGIS Mobile and the first of several updates we intend to bring to you over the next year.

If you have already installed ArcGIS Mobile 10 final, running the update setup will not ask you to uninstall – it will simply add new capabilities to your existing setup. If you have deployed the Windows Mobile application to devices, you will need to deploy a new version of the CAB and it will force an uninstall/install. The uninstall will retain your field projects and any local cache you have on your device will just work once the new version is installed.

Included in this update are the following fixes:

  • Create Mobile Map and Synchronize Geoprocessing Tools are now available with an ArcView license.
  • Improved stability with the Windows Mobile application (several memory management fixes to reported “out of memory exceptions” and/or “random crashes”, scrolling improvements for high-resolution devices.
  • Resolved issue with GPS Streaming where collection was not receiving first valid fix (SDK and both field applications).
  • Resolved Application Framework issue where events for GeometryCollectionStarting and GeometryCollectionCompleted were not being raised)

We look forward to hearing your feedback. If you want to provide us with your thoughts, please contribute to our ideas site @ http://ideas.arcgis.com.

Thanks,

Mobile Team

Posted in Mobile | Tagged , , | Leave a comment