Sunday, December 6, 2009

ESRI's European User Conference 2009 - Asides and Slides

In October 2009 HNIT-Baltic hosted ESRI's European Users Conference in Vilnius, Lithuania. I attended as an ambassador for ArcGIS Server, its Web APIs, and MapIt. This was my first foray into eastern Europe, and it turned out quite simply fantastic. Discussions with users and partners were spirited and exciting, and attendees in my sessions were engaged. The folks I met that work at HNIT-Baltic were exceptionally knowledgable and courteous, and simply ready for the next challenge.

The city itself was inviting, fresh, and personal. And I discovered a few things during my adventure: Lithuanians enjoy pizza with ketchup, because I was told it "adds flavor"; shopping malls look like factories on the outside, but they rival the best of So Cal on the inside, with better prices; and if you see a glass of water on a table at a party... it's probably vodka.

I've included a montage of a few photos I snapped with my trusty iPhone while in Vilnius (press "P" to pause).

If you attended the EUC in Vilnius or just want to view the conference materials, you can view and download the plenary and paper session materials from HNIT-Baltic.

To peruse the technical sessions I presented, I've made PDF versions of the session slides available below:
Building Mashups with ArcGIS Server
Building Great Web Map Applications
Whats New in ArcGIS Server 9.3.1

Sunday, November 1, 2009

Using the ArcGIS Server REST API in .NET applications

Over the past year I've handled a number of questions regarding the use the ArcGIS Server REST API in a .NET application. It can be done quite effectively, but isn't explicitly promoted by ESRI since the REST API is primarily designed to be consumed by pre-packaged Web clients like the ArcGIS JavaScript, Flex, and Silverlight/WPF APIs. However, using REST programmatically in a .NET application context without installing an ESRI product can make for some powerful and focused yet lightweight solutions. In addition, if you need to do something relatively simple you don't have to generate a load of client-side proxy classes like you do with SOAP.

I've included a simple code example below to highlight how easy it is to integrate ArcGIS Server services via REST in your .NET app. The example uses an ArcGIS Online geocode service to geocode an address and return a location.

Download the sample here.

There are a few items to consider when using ArcGIS services via REST in .NET:

  1. You will construct the url that will execute an operation on the server. Inputs to the operation are included in the url as parameters with values. Add a reference to the System.Web.dll and use the HttpUtility class to encode parameter values in the url.
  2. In most cases you will return results in JSON (JavaScript Object Notation) format. Add a reference to the System.Web.Extensions.dll (included with .NET 3.5, separate install for .NET 2.0) and use the JavaScriptSerializer class to deserialize JSON results into a dictionary you can use more effectively.

This example can easily be modified for use in a .NET CLR trigger for SQL Server to geocode address information upon entry into a table -or- in a batch process to geocode addresses in a database -or- show a location in a WinForm or WPF desktop client. The same idea can cross over into other ArcGIS Server services such as querying layers in a map or executing a geoprocessing service. In any case, you'll find the simplicity of the REST API refreshingly simple for those scenarios where you need to plug a little GIS into your app. One parting note, if you use ArcGIS Online services via REST, you'll need to follow the subscription model for the Web Mapping APIs. For example if you geocode more than 1000 addresses, you'll need to purchase a subscription.

Thursday, September 24, 2009

"Price check on Bing Maps"

Over the past couple months, I've chatted with a number of people interested in using Bing Maps services in their applications; map-centric and otherwise. If they had any questions or wanted to purchase a license, I always mentioned that they could contact Microsoft directly. This got me wondering, if someone did contact Microsoft with questions about purchasing a Bing Maps license, what would they experience? Simple enough to try – so I called their contact number listed on their licensing page.

I was directed to the voice mail of someone on the sales staff. His voice mail greeting provided his email address, so I decided to send him an email with a single question to get the ball rolling. Literally 7 minutes later I got a response… I was impressed. He needed more information, so I provided it and waited for a response. The following day I sent an email asking for an update and he called me within 5 minutes. Evidently he called my main work number and made his way to my desk… quick, resourceful… again I was impressed. After a lengthy conversation, a few interesting details about the licensing and cost of Bing Maps became apparent. Let’s start with the first question:

After the 90-day evaluation period, do I have to purchase a license to continue using Bing Maps imagery, geocode, and route services?

No, but the use case is very limited. You can continue to use Bing Maps staging services beyond the 90-day evaluation period if the application is:
1) available publicly, on the Internet, without restriction
2) completely non-commercial, meaning you make no money on its use, directly or indirectly

Note you still have to abide by the limits defined for the 90-day evaluation. So this pretty much covers soccer moms trying to organize team events on a map or allows your friendly fantasy football commissioner to show folks how to get to his house for the draft. Granted the Bing Maps imagery services will still have “Staging” plastered on each tile, so the map may not be very pleasing. Outside of this, all other scenarios require a license. This includes all internal applications (commercial or non-commercial, Web or desktop), all commercial applications, and all government applications. Logically this leads to the next question…

How much is a license to use Bing Maps?

Short answer…the standard package is $8000 for 1,000,000 transactions. This is the minimum to get started. The transactions sit a pool for use with all Bing services: imagery, geocode, routing, search, etc. So…

What is considered a transaction?

It depends on the service. The best place I’ve found to get detailed information on this is the
transaction report description for Bing Maps. In general, use the following as a guide:

8 map tiles = 1 map transaction
1 geocode = 1 transaction
1 route = 1 transaction

In the end, I was both impressed and satisfied with the responsive Bing Maps customer service. The guy I spoke with was clear, concise and real; he knew the technical details and presented it well. I’m definitely more comfortable referring folks to Bing Maps now that I know first hand what they’ll experience. I still find it interesting that if you are using a licensed ArcGIS product or API you can purchase access to Bing Maps through ArcGIS Online for significantly less - $2500 for 1,000,000 transactions (see the
price sheet). The only difference is ESRI customer service provides you with a Bing Maps account and you can purchase transactions in smaller blocks (100,000). In your application you still work with Bing services directly. We'll see what happens moving forward, but for now ESRI customers appear to have some options when buying into Bing Maps.

Sunday, August 23, 2009

ArcIMS equivalency in ArcGIS Server?

In May of 2000, ArcIMS 3.0 was released and over the next few years it took the Web GIS world by storm. There were few competitors, so the market was ripe. While it was considered complicated initially, most folks were able to buckle down and wrap their head around the technology - and build some rock solid solutions. HTML Viewer based applications, servlet connectors, and custom solutions using the ActiveX, ColdFusion or Java connector started popping up all over the Web. Turns out, ArcIMS was actually simple – all interaction was stateless and anything it could do on the server was dictated by ArcXML – so its boundaries were well defined. Plus it did its job very well. Dynamic mapping, feature streaming, queries, geocoding, extract... all were quick and efficient.

In the Web mapping world of late 2009, ESRI brings its wealth of GIS intelligence to a party that includes companies originally founded on search engines, operating systems, and business software. The market has expanded dramatically since ArcIMS was first released, and it continues to grow. ArcGIS Server now provides a comprehensive enterprise GIS solution for the Web with seemingly unlimited capabilities, especially when you factor in access to ArcObjects on the server. In general, it integrates with a diverse range of back-end data stores, utilizes an effective and robust authoring environment to build data and logic into a service, and it exposes numerous public Web service formats and protocols to support a wide range of consumers. In addition, a bevy of Web clients are available… server-side AJAX solutions using the ADFs, lightweight browser clients using the JavaScript API, and rich Web clients using Silverlight or Flex. With the sheer volume of features, functionality, frameworks and APIs in the ArcGIS Server suite, it remains unmatched as a complete enterprise GIS solution.

So with all this said, we know that ArcGIS Server can do so much more than ArcIMS in many areas, but are there still some things ArcIMS can do that ArcGIS Server can’t – or can’t do very easily? Yes. Let’s step through the ArcIMS service (virtual server) types as see:

Geocode? Yes, ArcGIS Server has it covered in the geocode service.

Route? Yes, ArcGIS Server has it covered in the network analyst extension on a map service.

Metadata? Yes. The GIS Portal Toolkit was added as an extension to 9.3. At 9.3.1 it was termed the ArcGIS Server Geoportal extension.

Extract? Yes, but it’s not as simple as ArcIMS. In ArcGIS Server you can emulate an extract virtual server with a custom tool (model) in a GP service. Granted GP can be very complex, but also very powerful... a good trade-off. Geodata services do provide an extract option, but the service was primary designed for the ArcGIS desktop client and functionality is limited to working with a geodatabase.

Feature? Yes, except it’s handled via a query operation on a feature layer in map service. The feature virtual server was primarily designed for the Java Viewer - the “rich” Web client when ArcIMS was first released. ArcGIS Server 9.4 will include a feature service with much greater functionality that that provided in ArcIMS.

ArcMap? Not quite. In general the ArcMap virtual server just exposes a subset of ArcGIS Server map service capabilities... so generating dynamic maps and querying layers is covered. One notable difference involves access to page layouts. In ArcIMS you can use GET_LAYOUT to generate printable output from a page layout in an mxd hosted by an ArcMap image service. In ArcGIS Server this capability is not available via a Web service protocol or format. Instead you must use ArcObjects (remote) and QI to IMapServerLayout from the map server object -or- use the Web ADF's PageLayout control which only works with local ArcGIS Server data sources. In either case interaction usually remains stateless.

Image (map) and query? No, but ArcGIS Server is crossing things off the list. On the server customization side, ArcGIS Server is unmatched. You can extend a server object in ArcGIS Server using .NET or Java –or- create and access ArcObjects remotely. In ArcIMS customizing a virtual server using C++ was rare and relatively difficult. There's also the issue of performance. Dynamic mapping in ArcIMS is notoriously fast. To match and exceed ArcIMS performance, ArcGIS Server provides the ability to pre-cache map tiles (9.2+) and to generate “fast” dynamic maps with optimized services (9.3.1+). One notable addition to ArcIMS 9.0 was the ability to reproject geometry using GET_PROJECT. This was covered in ArcGIS Server 9.3 with the release of the Geometry service.

With this out of the way, let’s focus on comparing the stateless capabilities of ArcIMS image\query and ArcGIS Server map services. Below I’ve listed six stateless capability categories that are popular in ArcIMS and still deficient at some level in ArcGIS Server:

  1. Reorder layers (including graphics) – It’s possible in ArcGIS Server but requires a stateful change and you must work with fine-grained ArcObjects.
  2. Change layer renderers – It’s possible in ArcGIS Server but requires a stateful change and you must work with fine-grained ArcObjects.
  3. Enable use of variable transparency for symbols (applied to graphic elements, selection sets, etc.) – Right now symbol transparency can be either 0% or 100%.
  4. Add dynamic layers – It’s possible in ArcGIS Server but requires a stateful change and you must work with fine-grained ArcObjects. If dynamic layers can be added, two additional capabilities will be necessary for equivalency:
    1. Enable joins in dynamic layers
    2. Query dynamic layers
  5. Support related data in query results - All ArcGIS Server map service query operations support returning joined data. In 9.3 the identify operation returns related data (SOAP only), but other query operations do not. So, to retrieve related rows in an ArcGIS Server map service right now, you have to use fine-grained ArcObjects and traverse the relationship class collection on a feature layer. This will change in 9.4; query operations will return related data.
  6. Fully support scale dependent rendering on a single layer - This is relatively easy to do with ArcXML in a map configuration file, but in ArcMap it requires VBA and the symbology is not readily accessible – namely the Toc swatches are empty. A better solution involves using a group layer in ArcMap. Essentially you add a reference to the same layer multiple times within a group and set the scale dependency and symbology for each layer. Unfortunately all the layers show up in the Toc (even those outside scale range) so the experience isn’t exactly like ArcIMS, which seems cleaner.

For the most part, ArcIMS equivalency can be found in ArcGIS Server. My interest in posting the exceptions is three-fold: to provide awareness of these issues, to mention resolutions pending in future versions, and to provide guidance on a current solutions or workarounds. If you’re aware of another ArcIMS equivalency issue in ArcGIS Server, I encourage you to add a comment below. Hope this was helpful.

Friday, August 14, 2009

ArcGIS Silverlight/WPF API and ESRI MapIt blogs up and running

The ArcGIS API for Microsoft Silverlight/WPF and ESRI MapIt, two new products in the ESRI suite, were released during the 2009 Users Conference in early July. Now, each has it's own blog hosted by ESRI.

Silverlight/WPF Blog:
ESRI MapIt Blog:

Both are available their respective resource centers as well (
Silverlight/WPF, MapIt).

I'm the lead product engineer for both products, so I've been busy working with a group of extremely talented developers at ESRI to build and get them out the door. The ESRI blogs should provide you with some great information about both products... good times ahead for sure.

Saturday, January 24, 2009

Consuming ArcGIS Server SOAP services in Silverlight 2.0

Microsoft's Silverlight platform offers yet another application environment in which to consume SOAP services. The Silverlight platform is truly tantalizing - the ability to blend\mash\mix services and data with a rich user experience in a web client is undeniably sexy and powerful. Unfortunately some of the backend plumbing still needs to be worked out. This includes Silverlight's ability to consume SOAP services, let alone ArcGIS Server's SOAP service stack. Sure, everyone's talking about REST and WCF, but W3C standard, contract based, explicitly typed interaction with SOAP services is still prevalent - just take a look at the recent release of the Virtual Earth Web Service SDK.

So how do you consume a SOAP service in a Silverlight application or class library? Once you install the Silverlight tools with Visual Studio (or Web Developer) 2008 sp1 you will be provided with a context menu item off the project in Solution Explorer. The item is named "Add Service Reference" and opens a dialog box for a developer to define the endpoint to a service (WCF,SOAP) and a namespace for the native client types that will be generated.

This capability is synonymous with the "Add Web Reference" capability for SOAP services in standard .NET projects. A single url to a WSDL is used to construct a SOAP proxy and a set of value object types. This provides a nice interface for one-off services, but if you have a set of services that share value object types and you want to generate a single library with a single namespace, you need to use a command line tool. This is possible with the NET 2.0 and 3.5 SDKs which include the web service utilities wsdl.exe and svcutil.exe, respectively. Note, wsdl.exe output is supported in .NET 2.0 - 3.5. Unfortunately Silverlight does not provide the same or similar utility. Before Silverlight 2.0 final was released, a utility named slwsdl.exe was available for this purpose. Unfortunately it was removed from the 2.0 final release for reasons unknown. In addition, the output from wsdl.exe and svcutil.exe will not work with Silverlight applications. Both wsdl.exe and svcutil.exe generate references to types that are not available in the Silverlight platform. Problematic type references generated in svcutil.exe output can be removed so reference code can actually be built as a Silverlight class library. Unfortunately the proxy class includes both synchronous and Begin\End asynchronous methods. Neither pattern is supported in a Silverlight application. In fact, the Silverlight "Add Service Reference" tool only generates Async\Completed asynchronous methods, which is the "promoted" pattern for event-based asynchronous programming. Apparently there is no way to trigger svcutil.exe to only generate the appropriate asynchronous methods for Silverlight and synchronous methods are not officially supported in Silverlight, apparently due to cross-browser support issues.

So with all this in mind, how can you generate a single library that contains all the proxy classes and value object types for all ArcGIS Server service types? It’s hokey, but you need to manually merge all WSDLs into a single WSDL – being careful to place the element types in the same locations (e.g. element vs. operation, etc.). You only need to do this once since the library you generate will be distributable thus reusable for all Silverlight applications\libraries. In fact, the sample included with this post includes the reference class file generated from this process, so you don’t need to mess around with the ArcGIS Server WSDLs – just download the sample and compile the ArcGIS_SOAP_Silverlight project. Or just use the precompiled ArcGIS_SOAP_Silverlight.dll in the bin folder.

The sample is available here.

The sample also contains a Silverlight application that illustrates a simple use case for consuming an ArcGIS Server dynamic map service and navigating the map. Left mouse click on the map zooms in, Shift+left mouse click zooms out. Note you’ll need Visual Studio 2008 sp1 and the Silverlight tools to load and build the projects in the solution (see for more info). You can give a test run below. It's designed to be instructive, so it's pretty simple.

One additional note, the Web site that hosts the ArcGIS Server services must have a clientaccesspolicy.xml(Silverlight) or crossdomain.xml(Flex) in place to support cross domain\site requests. Silverlight will work with either. If using crossdomain.xml the following entry will enable SOAP interaction for all consumers:

<allow-http-request-headers-from headers="*" domain="*">