Category: Developer

Context menus made easy: in Java

As many of us might agree, context menus are a great way to place functions where users would intuitively expect them to be.  Right-click on a layer (provided your mouse has a right button) and capabilities specific to that layer should pop-up.  Right-click somewhere else, and the options hovering under the mouse change to something else.  This is a proven approach for helping your users do what they want to do more efficiently. Java developers who are using the ArcGIS Engine development kit are not provided the ability to create context menus right out of the box.  

Steven Rozic and Lalitha Darbhamulla from ESRI recently uploaded a Code Gallery sample that we all hope you will find helpful.  It’s called “Creating a Context Menu for Layers“, although the source code could be applied in other contexts as well. An extra bonus:  the download includes two options to choose from.  One uses the ArcGIS ToolbarMenu and the other uses the JpopupMenu from the Java Swing package. 

 

 

Posted in Developer | Tagged , , | Leave a comment

New ArcGIS Developer Poll!

We would like to introduce the new online ArcGIS Developer Poll.  If you remember way back, we had a similar poll on the old EDN site. 

One of the main goals of this poll is to stay in touch with the developer community and to give you an opportunity to provide us with some direct feedback.  We’ll be using this information to post a other questions and blogs topics in the future. 

Feel free to add comments here about other polls and/or blog topics that you would like to see.

Keep your eyes peeled as we release new questions. 
EDN Team

Posted in Developer | Tagged , | 1 Comment

ESRI Releases the ArcGIS API Evaluator

If you haven’t heard, the ArcGIS Development Team has just released a new .NET utility called the ESRI API Evaluator.  This handy tool allows you to scan all of your ArcGIS .NET code and generate a complete set of API usage statistics.  This will reveal the DLL dependencies, version information and the number of calls made to all ESRI assemblies, interfaces and members. 

Help improve the product
One of the most important features of this tool is that it allows you to send your API usage information directly to the ArcGIS Development Team.  Once received, this information will be used to:

1.    Better understand the APIs that our customers are using (most popular).
2.    Make improvements to focused areas of the SDK (documentation and samples).
3.    Make decisions for future API development projects.

API Evaluator Scenarios
Scenario I – Help improve the SDK
You have been working on a number of ArcGIS projects and have had difficulty implementing various parts of the SDK.  Use the API Evaluator to let ESRI know what areas of the API are most important to you by uploading the usage statistics without actually sending us the code!

Scenario II – Improve your code
You have been working on an agile development project with a team of developers.  You would like to discover which parts of the API have been used the most by the team and if code reuse has been maximized.  Use the API Evaluator to determine the number of calls to all interfaces, methods and properties in the .NET assemblies and look for areas of improvement.

Scenario III – Deployment
You would like to determine the .NET Framework version, and ArcGIS license and extension requirements for an application.  Use this information to help determine the software and licensing requirements for deployment systems.
 
It’s easy to use!

Step 1.  Start the tool and run a new scan.

Step 2.  Select the folder(s) you wish to scan.    
 
NOTE:  If you are scanning a Visual Studio 2005/2008 web application, build and publish the website to generate the precompiled assemblies first.

 

Step 3.  Optionally, supply your contact information if you plan to upload your scan to ESRI. 


 
Step 4 – Confirm your selections.

 

Step 5 – Review the results.

Step 6 – Upload results to ESRI. Simply select the “Upload Scan” menu.

A few reasons to give it a try
I’m sure you can think of many different uses for this tool, but in general, you can use this tool to: 

1.    Determine the general API usage for larger or unknown code samples.
2.    Determine the licensing required to run an application.
3.    Locate redundant code sections and make improvements.
4.    Detect library dependencies to help with deployment scenarios.
5.    Detect .NET version dependencies.
6.    And most importantly, help improve the product (see below).

More Information
Where can I download it?  You can download the tool from the ArcGIS Engine Code Gallery.
Where can I find more information? You can find the documentation on the ArcGIS Engine Resource Center online.

We want your feedback!

Although the “Upload Scan” functionality is 100% optional, we do appreciate all feedback from the developer community, so we hope you find this tool useful and you can spend a few minutes uploading the results back to ESRI. 

Let us know if you have any questions or feedback.

Thanks for your participation!
ArcGIS Development Team

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

Podcast: Introduction to ArcGIS Engine Development

 

The ESRI Instructional Series has a new podcast out there called “Introduction to ArcGIS Engine Development“.   It is about eight minutes long and it provides an introduction to ArcGIS Engine and how it can be used to develop standalone applications and extend existing ones.  Described in the podcast are the SDK itself, customization options, licensing, ArcObjects model, and the application framework.

So, whether or not you have programmed using ArcObjects in the ArcGIS Desktop VBA editing environment, this podcast provides a good overview of the ArcGIS Engine development toolkit.  For more information, a great way to get started is at the ArcGIS Engine Resource Center.

 

Posted in Developer | Tagged , | Leave a comment

New Error Reporting in ArcGIS 9.3

One of the new capabilities of ArcGIS 9.3 is the ability to send error reports to ESRI anytime that ArcGIS fails.  Problems due to memory leaks, hardware limitations, incompatible third-party extensions, and others have been known to be disruptive to your work and can be extremely frustrating.  We expect this new functionality will help us identify and solve problems quicker and more completely than ever before.

This post here in the Geodatabase Development Blog goes into this further and includes a link to a short two-minute video from Todd Stellhorn (development lead for ArcGIS 9.3) who describes how this works in more detail.

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

API Evaluator: Inspect your code, send us your feedback, improve the product!

Here is a new .NET utility that you might find useful. The API Evaluator is a tool that allows you to scan your ArcGIS .NET code and generate statistics on the API usage.  It also provides you with a mechanism to send feedback directly to ESRI about the APIs that are most important to you.  Read on if you would like to know more.

How it works
The API Evaluator allows you to browse to a .NET .exe or .dll, scan the code, and identify all of the calls to ESRI types.  The report and statistics are returned to you in an interactive Results Viewer window.  This information reveals the following:

1.    The .NET assembly references found;
2.    The assembly version;
3.    The ESRI types called; and,
4.    The number of times a call is made to each interface, property and method.

Scenario: Exploring the unknown…
You download a large code sample and know very little about how the code was written or what types are referenced.  Simply use the New Scan option to step you through the scanning wizard browse to the assembly and generate statistics.  Use the Results Viewer to and expand the treeview and view the number of calls to each item. 

Evaluating the Results
The API Evaluator revealed that the code makes a total of nineteen calls to ESRI objects, from five libraries: DataSourcesGDB, GeoAnalyst, Geodatabase, SpatialAnalyst and System.  Two of the calls are made to objects in the SpatialAnalyst library. All of this information is recorded and displayed in the Results Viewer.

So why is this important? 
In this case, the tool revealed that SpatialAnalyst types are called, and therefore, the code will require clients to check out a SpatialAnalyst license at runtime. 

Benefits 
I’m sure you can think of many different uses for this tool, but in general, a developer could use this tool to: 

1.    Determine the general API usage for larger or unknown code samples;
2.    Determine the license-level required for an application;
3.    Refactor and improve your own code where redundant calls are identified; 
4.    Detect library dependencies to help with deployment scenarios.
5.    Detect version dependencies.

BONUS – Send us your feedback!
As an added bonus, the tool also allows you to upload your scan results directly to the ESRI Development Team.  When you upload, you have the option of providing your contact details before the information is sent to a web service hosted here at ESRI.  Once received, your statistics will be analyzed further to:

1.    Better understand the APIs that our customers are using (most popular).
2.    Make improvements to focused areas of the documentation and samples.
3.    Use the information for future API development projects

For more information on the tool, you can review the documentation or download it from the Code Gallery.

Your Feedback is important
Although the “Upload Scan” functionality 100% optional, we appreciate all feedback from the developer community, so we hope you find this tool useful and you can spend a few minutes uploading the results back to ESRI.

Thanks again for your participation!

 

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

API Evaluator: Help us assess and improve our .NET APIs

ESRI appreciates the efforts of our developer community who help us discover how they are using our application programming interfaces (APIs). We also realize that as GIS developers, you have an interest in finding out useful metadata about your own custom applications. This has prompted us to develop the API Evaluator: a utility that gathers information about your code, by scanning exe or dll files for specific usage of .NET types released by ESRI.

Imagine you have written and built your own extension MyExtension.dll, which uses classes from the SpatialAnalyst ArcObjects library.

You scan defined search locations on your machine using the API Evaluator. The locations specified are searched for exe and dll files. Those files that reference .NET types released by ESRI are analyzed to find out how the API is being used.

During the scan, the API Evaluator detects that MyExtension.dll references an ESRI assembly and determines that two calls are made to objects in the SpatialAnalyst library.

This information is recorded and displayed in the Results Viewer.

 

The API Evaluator reveals that your extension makes a total of 19 calls to ESRI objects, from 5 libraries: DataSourcesGDB, GeoAnalyst, Geodatabase, SpatialAnalyst and System.

You drill down into the results to find out how many times a specific method is called or accessed, as well as detect which version of the libraries MyExtension.dll is referencing. The versioning information is of particular interest because you are planning to upgrade MyExtension.dll to support ArcGIS 9.3.

You choose to upload the results of the scan to a Web Service hosted by ESRI for further analysis.

Why use the API Evaluator?

It’s benefits are twofold; you gain a better understanding of which ESRI libraries and objects you are using and, by analyzing developer utilization of the current APIs, ESRI gains a better understanding of the needs of its users. ESRI will use any results from the API Evaluator to inform the design of future products for GIS developers.

As an added benefit, the API Evaluator can also be used to scan .NET sample applications, executables, and assemblies that you download from the Resource Centers, their code galleries, or ArcScripts. You can quickly determine whether the download uses ESRI libraries and objects that are of interest to you.

For more information on the tool, you can review its documentation or download it from the Code Gallery. We hope you can spend a few minutes using this tool and uploading the results – we really appreciate every bit of feedback we get.

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

VB6 to .NET Migration Series: Getting ready for the ArcGIS 9.4 release

At the 2008 ESRI International User Conference  we announced that ESRI would no longer support the development of Visual Basic 6.0 applications at the ArcGIS 9.4 release.   Well, it is true.  As we speak, the development team is in the process of removing the VB6 DLLs and dependencies throughout the system.  So what does this mean for VB6 developers that plan to release their software applications on ArcGIS 9.4?  Well here are some inside tips that will help you plan for the future.
 
 
 
Visual Basic 6.0 SDK and Runtime
1. The Visual Basic 6.0 SDK will not be delivered with any of the ArcGIS 9.4 products.  Developers will not have access to the VB 6 developer help files, tools, add-ins and utility applications. 
 
2. The Visual Basic 6.0 Runtime will no longer be installed with any of the ArcGIS 9.4 products.   Therefore, if you still plan to deploy VB applications, you will need to ensure the VB 6 runtime has been installed by another application or you will need to install it as part of your deployment solution. 
Can you still develop with VB6?
Compilation:  The ArcObjects Type Libraries (OLBs) will still be shipped and installed with ArcGIS 9.4. As a result, as long as you don’t mind not having the ArcObjects VB6 SDK or any development tools, technically speaking, if you have a Visual Basic 6.0 development platform, you can still reference libraries and compile your applications.
 
Compatibility:  As long as the VB6 runtime is in place, it is possible that your applications will just work on an ArcGIS 9.4 system.  But please remember, while we make every effort to maintain backward compatibility, it is still your responsibility as the developer to reference the type changes and ensure that all applications behave as expected.
 
Microsoft Support:  In February, Microsoft released a “it just works” support statement indicating that they will continue to support the VB6 runtime on Windows 2008 and Vista; however, it is important to note that the VB6 IDE has gone past the period of extended support.  So that is something you may want to consider this as well.
What about VBA?
The Visual Basic for Applications SDK will still be released with ArcGIS 9.4 to support VBA development inside of the ArcGIS Desktop applications.  So VBA developers do not need to migrate their applications to .NET.
 
Should you still be developing with VB6? 
The bottom line is that if you are planning to develop applications for ArcGIS 9.4 and beyond, we strongly encourage you to start moving your VB6 applications to C#, VB.NET or VC++.

 

Making the Leap
You can find a number of articles on MSDN about how to make the switch from VB6 to .NET.  If you are thinking of transitioning to Visual Basic .NET today, there’s also a good set of articles here to get you started.   You’ll find that most of the documentation refers to Visual Studio 2005, but most of it applies to 2008 as well.  That said, you’ll need to decide whether to move to Visual Studio 2005 or 2008.  The current release of ArcGIS 9.3 supports development with both platforms.
 
Future blog series
To help you make the transition, be sure to stop by again or subscribe to view the upcoming VB6 to .NET Migration Series for ArcGIS developers.
 
 
 
 
Feel free to share your comments, links and experience here as well.
 
Posted in Developer | Tagged , , , , , | 1 Comment

Code Snippets: write 'em, save 'em, reuse 'em

The “DRY” principle describes an element of programming efficiency:  Don’t Repeat Yourself.  

One of the tools available to help you with this are Code Snippets.  ArcGIS 9.3 products ship with hundreds of these snippets you can quickly and easily find and use, but how can you create them, add to this repository, and share them with others?

Back on July 14th, Don Kemlage from the ArcGIS SDK team posted a video here on the blog to describe what snippets are, how to get to the ones we provide with ArcGIS, and how to use the Snippet Finder.   At about 10:50 minutes into that video, Don mentions briefly that developers can make their own snippets too.  In this post here, we wanted to dig a little more into that, and provide some tips on how to do it in more detail.

Frameworks such as Visual Studio and Eclipse provide several ready-to-use Code Snippets.  You can even add your own snippets into the library, organizing them into a directory structure by the subject or task they accomplish. Creating your own code snippets helps you and your team members have snippets which are greatly customized for your development.

Code snippets are defined in XML format and are stored with the *.snippet file extension. You can use your favorite XML or text editor or Visual studio or Eclipse to create and maintain them.

 

Creating Code Snippets in Visual Studio 2005/2008

MSDN has a nice concise “How To” article on creating code snippets.

In short, using Visual Studio 2005/2008 start with the File > New > File > XML File menu item.  That allows you to create the new file and save it in place, ready for editing.  Then the next step is to plug in the required information to make it an individual code snippet. Let’s show you an example code snippet, then further below we’ll explore the tags one by one.

 

Let’s walk through it, top to bottom.

CodeSnippets
The <CodeSnippets> element is the root element of the code snippet XML schema and has xmlns attribute value.

CodeSnippet
The  <CodeSnippet> element is used to create an individual code snippet and this is where all declarations on your snippet must reside.

Header, Title, Shortcut, Description, Author, SnippetTypes
The <CodeSnippet> tag has a <Header> section that contains information needed by the IDE in these additional tags.  Visual Studio gives you a description of what each one does when you hover your mouse on these tags. 

Snippet
The <Snippet> tag is a little bit more complex. It contains both the <References> and <Code> tags.

References
 The <References> tag is used by the IDE to add references to the project when the snippet is inserted. In this example, the code snippet adds a reference to ESRI.ArcGIS.esriSystem.dll when the snippet is inserted. Note that Visual C# code snippets do not support the References section, so a reference to ESRI.ArcGIS.esriSystem.dll must be added to the project manually.

Code
The <Code> tag contains the specific code to insert as <Code Language=”VB”> that says that the language of the code snippet is Visual Basic. All snippet code must be placed between <![CDATA[ and ]]> brackets. You can also mention (in comments) what ArcGIS Products and which versions (9.2, 9.3) can use this snippet and any other namespaces that you wish the user imports before adding.

Ok, so after doing this a couple of times they are pretty simple to create.  And whether you write them using Visual Studio or a plain text editor, give each one a *.snippet file extension and use the Tools > Code Snippets Manager menu item to ensure the IDE knows where these folders are.

Code Snippets not only provide a wide variety of productivity-enhancing solutions and their real power lies in their extensibility. Give them a shot.

Contributed by Sirisha Karamchedu from ESRI Educational Services

Posted in Developer | Tagged , , , | 2 Comments

New Community Center for ArcGIS Mobile!

The ArcGIS Mobile Resource Center introduced a new Community Center today!

The goal of the Community Center is to grow a vibrant online community centered around Mobile GIS. The community center aggregates all sources of information that change frequently so you have the most recent information. It includes this blog site, forums, knowledge base articles, and a code gallery for developers.

With the launch of the community center, the mobile dev team has uploaded a number of code samples that you can download in the code gallery. All samples uploaded by the dev team are clearly indicated by the “ArcGIS Mobile Development Team” tag on the sample.

During our presentations at UC2008 (both in the technical workshops and at the Mobile Island Demo Theatre), we wrote a lot of code and those of you who attended our presentations have asked for us to share it with you. So the code samples prefixed with “ArcGIS Mobile – ” are exactly those samples. Once you have taken a look, please come back to the code gallery and give these samples a rating!

To post your code to the code gallery, all you need to do is log into the code gallery using your ESRI Global account. If you do not yet have one, you can sign up for one here.

 

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