About this blog...

The people of Esri UK sharing what we do, what inspires us and how we get the most out of Esri technology.

Entries on this blog are the views of the individual authors and do not necessarily represent the views of Esri UK.

Search
LVF Blog Page
CommunityHub
Schools Blog Page
Technical Support Blog Journal
Wednesday
Jan302013

Create your first Runtime Application in 10 minutes

ArcGIS Runtime enables you to build rich, highly functional GIS applications. The desktop version comes in WPF (.NET) or Java and has been designed to allow for quick development and easy deployment, but also power analysis. I want to show some of these features by providing some interesting resources and a quick tutorial on how you can rapidly develop a sample application. I will step through how to create a simple routing application that should take less than 10 minutes development time.

1.       Setup

The example will be based on the WPF version and you will need one of the development tool kits to start. The Runtime SDK is only available through a subscription to the Esri Developer Network (EDN). If you have a subscription the Runtime will be available to download and install. You will also need Visual Studio 2010 or 2012 for the WPF or Eclipse for Java. If you do not have an EDN subscription, don’t worry you can still continue with the WPF API. This is available to freely download from the Esri Resource Centre, here. This is an earlier version (2.4) of the WPF API used in the Runtime, which is currently at version 10.1.1. The WPF 2.4 version can be used to connect to online data and resources. It cannot work off-line like Runtime and is not as functionaly rich but can give you a good feel for some of the functionality available in the full Runtime version. The workflow in the example will therefore be slightly different depending on the version installed. Once you have either the free WPF API or Runtime SDK installed continue to the next step.

2.       Sample Application

Next we will have a look at the sample application that comes with the Runtime. If you have the full Runtime SDK this should have been installed with the rest of the Runtime components. It is called ArcGIS Runtime WPF Samples 10.1.1 and will be in the installation folder. If not, it can be downloaded from ArcGIS Online here. The sample application has many different samples of the main functions you may need to develop with Runtime. It has a live sample and all the code that is used in the sample. The sample we want to use is under Geoprocessing > Network Routing > Drive Times Online. Find the sample and keep it open ready to cut and paste some code.

3.       Create Application

We are now going to create a WPF application. This step will differ depending on the API / SDK installed. If you have the full Runtime SDK, open Visual Studio (VS) and create a new project. As part of the SDK a template application is installed in VS, this should be under Installed Templates > Visual C# > Windows > ArcGIS >ArcGIS Runtime SDK 10.1.1 for WPF Application. Select this and choose a suitable location and name. If using the WPF 2.4 API, follow the instructions here to set up a project.

4.       Add Routing

Now we can add the routing capability from the sample application. This will be the same for both versions. We will be using the ArcGIS Online European routing service that is available for developers to use in their applications, details can be found here. First we will update the XAML code. Copy the code in the sample from the Grid tag, do not copy the UserControl tag. Paste this into your applications XAML below the Window tag overwriting the current XAML. Next copy the C# code behind from the sample; you need to copy the code from the first private void method, MyMap_MouseClick. Make sure to leave two curly brackets at the end and not to copy them. Paste it into the C# code in your application after the public MainWindow() method. You will also need to add a reference to Client Tasks at the top of the application like:

using ESRI.ArcGIS.Client.Tasks;

If you run the application it should start up in Redlands and the routing should work. We want to use the European routing service and start the map in Aylesbury in the UK. To add the European routing service, copy the REST end point from the link above and paste it into the url tag of the RouteTask in the XAML:

<esri:RouteTask

                x:Key="MyRouteTask"

                Failed="MyRouteTask_Failed"

                SolveCompleted="MyRouteTask_SolveCompleted"

                Url="http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_EU/NAServer/Route" />

 

5.       Add Aylesbury basemap

Now we are going to add the base map for the application. There will be two different ways of doing this. For the full Runtime SDK we are going to use a local tile cache and for the WPF 2.4 API we will use an ArcGIS Online basemap as we cannot use local off-line data with this API.

5.1   Full Runtime

Here we will be using a tile package for the basemap. Packages are the medium through which Runtime can work off-line. Tile, Map, Geoprocessing and locator packages can be created in ArcGIS Desktop 10.1 and accessed by the Runtime. For this example I have created a tile package of Aylesbury from Ordnance Survey Open Data, it can be downloaded here. Put the package in an appropriate folder that can be accessed by the application.

In the XAML code replace the <esri:ArcGISTiledMapServiceLayer tag from the sample code with <esri:ArcGISLocalTiledLayer, providing the path to the tile package that has just been downloaded. It should look like:

 

            <esri:ArcGISLocalTiledLayer ID="Aylesbury" Path="Data\OS_Open_Base_Map_Aylesbury.tpk"/>

 

Remove the Extent property from the esri:Map tag. Now run the application, it should open with a map on Aylesbury, and click the map to add locations to return the simple routing.

5.2   WPF 2.4

Here we are going to add the ArcGIS World Street Map and set the extent to Aylesbury. First change the url in the <esri:ArcGISTiledMapServiceLayer tag from the World­_2D basemap to the World Street Map, url below:

http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer

 

 

Change the Extent property in the Map tag to:

Extent="-122540,6753761,-59385,6808602"

It should now look like:

<esri:Map x:Name="MyMap" WrapAround="True" Background="White" Extent="-122540,6753761,-59385,6808602"

                  MouseClick="MyMap_MouseClick">

            <esri:Map.Layers>

                <esri:ArcGISTiledMapServiceLayer

                    Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>

 

Run the application, it should open with a map centred on Aylesbury, click the map to add locations to return the simple routing.

That’s It

Hopefully that was not too difficult to follow and you now have a simple routing application. I have been working with the Runtime since it was released and think it is a really nice toolkit that can be used to build very powerful mapping applications. There are lots of resources to make development quick and simple, many of which I have referenced here. If you want to develop a desktop mapping application or integrate mapping into your current desktop application, Runtime is now the easiest way to do this and should be the first point of call.

 

Tuesday
Jan222013

Why are there so many Runtimes?

There has been a little bit of confusion about what Runtime is and why there are so many different Runtimes. So I am going to try and clear a few things up.

Runtime is not actually one product but rather the Runtime name spans over many different developer products. The Runtimes as a whole can be seen as a set of developer toolkits that allow you to develop applications that run locally on a device. The power of the Runtime comes from being able to take full advantage of the platforms they run on. So for example on the mobile platforms you can access the GPS or accelerometer and the Desktop Runtimes can use the full computing power of the device the Runtime application is running on. This allows you to develop fast powerful applications and in the case of the Desktop Runtimes they can run off-line. Off-line functionality is expected in the Mobile Runtimes this year. There are eight Runtimes in total; these can be broken down further into two buckets, mobile Runtimes and desktop Runtimes.

 

Each Runtime is a unique SDK and is developed in the relevant language depending on the platform (table below). The functionality between the Desktop and Mobile Runtimes is actually quite different but within the two buckets themselves the functionality is very similar. The licencing for the two Runtime buckets is also different.

Table 1: Runtime Development languages

Windows

Linux

Windows Mobile

iOS

Android

Windows Phone

.NET WPF & Java

Java SE

.NET CF

Objective C

Java

Silverlight

 

I hope it is now a bit clearer what the Runtimes are and where they sit. All that is left to be said now is happy developing and on that note I will post a follow up blog explaining how to get started developing with the .Net WPF Desktop Runtime.

Friday
Jan042013

Demystifying Mobile

The world is going mobile and your GIS can to.

It is estimated that there are now more mobiles than humans, consequently GIS users increasingly want to access maps and information from a mobile device. This post is a whistle stop tour of what ArcGIS for Mobile applications are available.  If you want more information please check out the links. 

As the picture below shows the mobile platforms can broadly be grouped into ‘Smartphones and Tablets’ and ‘Rugged Devices’.

Smartphones and Tablets

There has been a proliferation of smartphone and tablet devices (e.g. iPhone, Android and Windows Phone) over the past few years.  There are ArcGIS applications for the following Smartphone and Tablet platforms:

  • ArcGIS for iOS
  • ArcGIS for Android
  • ArcGIS for Windows Phone

For more information, on these free downloadable applications, click here.

Rugged Devices

‘Rugged devices’ refer to mobile hardware designed for high accuracy data capture (e.g. Panasonic Toughbook, Trimble etc.).  This group has traditionally been separate from the consumer mobile space of smartphones and tablets.  The Esri applications that run on rugged devices are:

There are heaps of mobile devices on the market and Esri support lots of them with applications.  Consequently device is becoming less of a barrier for adopting GIS.  Also with increased functionality being delivered across these devices through out of the box apps, the barrier of entry is lower than ever before.  

Custom mobile applications

What if the applications don’t have specific functionality you need, or you want to customise the look and feel of them?  There are several options for developing custom mobile applications and these are supported by resources and online communities.

SDKs

Esri provide SDK’s as well as Applications for iOS, Android, Windows Phone, Windows Mobile and ArcPad.  The SDK’s allow you to create custom GIS applications native to each platform.  This allows you to develop applications in native code for the device you’re targeting where the functionality and UI can be customised.  In the case of iOS, Android and Windows Phone apps these can be deployed in the respective market place.

Mobile Web

An increasingly popular option in the mobile arena is to host mobile applications in your browser, otherwise known as Mobile Web.  This allows you to develop applications in one code base and deploy it to multiple platforms.  Esri supports mobile web development through its Compact JavaScript API.

Cross Platform

The other developer option available is to write in one code base and deploy as a native application using third party software (e.g.  PhoneGap, Adobe Air and MonoTouch).  An example of this would be an application written using the JavaScript API and deployed to Android, iOS and Windows Phone using PhoneGap.

 

In summary, there are ArcGIS applications available for a wide range of mobile devices and uses. The capability of these continues to increase, but there are also different options available for ArcGIS mobile development.  

Friday
Dec142012

All I want for Christmas is a new release of ArcGIS Online

So Christmas has come early in ArcGIS-land and the busy elves as Esri Inc have released the latest version of ArcGIS Online. Apart from enjoying the chance for some bad festive puns one feature in particular prompted this blog piece: the ability to Register secured ArcGIS Server services with ArcGIS Online. An organisation can now use ArcGIS Online to broker secure connections to services and then control access through the ArcGIS Online sharing mechanism.

So why is this exciting enough for me to be posting this last thing on a Friday...? The Esri UK hosted map services (http://www.esriuk.com/products/data/online ) can now be used within ArcGIS Online to provide basemaps in BNG (British National Grid). Having created a webmap with a BNG basemap additional BNG data can be added directly without a transformation. As a first go, I added one of the hosted services to my content and logged my datahub account details. In a new map I can set it as the basemap (by clicking on the service name in the listing and choosing the 'add as basemap' option) and then add a BNG shapefile directly to the map. I've also checked an existing BNG map service with the OS basemap too.

This feature also really opens up the potential for using ArcGIS Online alongside an organisation's existing ArcServer based services. Perhaps using ArcGIS Online for hosting public communication sites, or by making use of the built in support for the smartphone apps.

So far I've only had chance to have a very quick look at a couple of the other new features. The filtering that can be applied to services within a webmap should allow subtle control of content within maps to ensure the target audience get just the information they need. The table display for data also looks set to be useful for comparative viewing of feature attributes.

Finally, I had a quick go with the the new application template that includes an elevation profile. I've only tried the demo elevation service that comes with it and the elevations generated quickly. The examples I was doing were a bit subtle and then I remembered how flat Aylesbury is... The profiles were much more exciting when I moved to a lumpier bit of the UK.

Full details of the features in the new release are here: http://resources.arcgis.com/en/help/main/10.1/#/What_s_new/01w10000001q000000/

In summary, the ability to register secure connection details allows ArcGIS Online users to use OS base mapping via the Esri UK online data services. 

 

Friday
Nov302012

Flex Application Builder - Web Application Development for the Non-Developer

I have long been impressed with some of the whizzy web applications built by Esri Inc and my colleagues in Esri UK but, being a GIS user and not a developer, I have always struggled to build something pretty and functional quickly.  Historically, I had to resort to using the Web Mapping Application bundled with ArcGIS Server Manager, but the look and feel of this has not changed in several years and it’s starting to look tired.

The introduction of the Flex Viewer was good for me as it meant I could now take a copy of a pre-built web application and then (in theory) I just had to tweak a little bit of xml to make it work against my own services.  However, opening the various config.xml files was a bit like opening a novel in a foreign language; it just doesn’t make much sense.  Try as I might, a quick tweak of some xml soon became half a day of trying to get it to work because I’d put a comma or <> in the wrong place; sooner or later I’d either give up or ask someone else to help me.

I was, therefore, very pleased when the Flex Application Builder was released.  If you have not looked at this yet, I recommend you give it a go.  It provides a simple GUI for selecting the services and functions you want to include in your web application as well as altering the style and design.  It even allows you to preview it before you deploy it to check it works. 

One thing I’ve found very useful is the ability to add a geoprocessing tool by simply pointing it to my geoprocessing service (that I’ve created from a desktop model) and it will automatically build the appropriate dialogue for the end user.  I even get the choice of how to display the results on screen.  Now I can create complex web applications such as find my nearest available resource by drivetime without any coding!

The release of these Application Builders all sounded a bit too good to be true and to be honest, when I first used the Flex Application Builder, I found it to be a little hit and miss.  The builder did not give me access to the full range of widgets included in the Flex Viewer and it was not intuitive how to set the various options.  Furthermore, once a site was built, you couldn’t always go back in and edit your site.

Things have improved though.  More recently, I have been using the ArcGIS Viewer for Flex Application Builder (v.3) to build a variety of demonstrations and I must say I am genuinely impressed with what I can achieve without any development.  The build and edit environment seems to have been greatly enhanced and stabilised and I can happily go back to sites I have created time and time again to make edits.

For me a really simple (but useful) benefit is the ability to add the same widget multiple times (e.g. the query widget) but change the icon and service it works against which allows me to create simple yet powerful web applications.  For example in the screenshot below I have used the Query widget twice (once for Incidents and once for CCTV camera locations) and chosen appropriate icons to make the user experience easy.  

 

Another useful thing I’ve discovered about the ArcGIS Viewer is that more and more free widgets are being developed and shared that you can easily add to your application.  Again, in the past this would have meant getting into development code, but now with Flex Viewer 3, it is easy to add custom widgets to the application builder through a Manage Custom Widgets tool.

In summary; I can now do (most) of the web application development I want/need to without ever opening an xml file, which has got to be good!

Useful links for you to get started

Information on Flex Viewer Application Builder:
http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#//01m30000002v000000#GUID-A2B1AFDD-5EA1-4B8B-A05A-8D20575DE2A7

Download for Flex Viewer Application Builder:
http://www.esri.com/apps/products/download/index.cfm?fuseaction=download.all#ArcGIS_Viewer_for_Flex

How to build your first site:
http://www.esri.com/news/arcwatch/0212/creating-an-arcgis-viewer-for-flex-step-by-step.html

Where to find sample widgets for Flex
http://www.arcgis.com/home/search.html?q=widget%20flexViewer%203.0&t=content&start=1