Your Cache Portfolio – Part 2

In Part 1 of our mini-series on cache, we covered its implications with the default map and using other maps and layers from the Resource Center. Here in Part 2 we’ll take a closer look at managing cache when connecting to individual services and local data.

ArcGIS Explorer either fetches cache (when leveraging cache or cache-on-demand capabilities in ArcGIS Server) or creates it when you first connect to content. This happens whether it’s an internet service or local data. This results in optimized performance, and also enables offline use. But there may be times when we don’t want to create cache, or when we might want to update it at regular intervals. For example, when we connect to a weather service that is continually updating.

When you add content to ArcGIS Explorer you go through a wizard, and will eventually see the Disk Caching Options dialog (except when you connect to GeoRSS feeds, or add KML or KMZ, which don’t use this option).

 

Let’s examine the options more closely.

Save layer’s disk cache when saving map file.

This option is the default, and is appropriate for any non-dynamic content source. This will ensure that cache that is fetched or created during your session is saved locally when you save your map. The next time you open the map, you won’t have to fetch or create cache again; it will be read directly from your local cache saved to disk.

Create a disk cache for the layer during the session.

Cache will be created as you work with your map during your session, but won’t be saved. This is appropriate for content you know will change, but aren’t sure how often it may be updated. It can be augmneted by choosing a time interval for refreshing the cache, discussed below.

Don’t create a cache for the layer on disk.

Cache won’t be saved at all, but this means that it will be continuously fetched or created. 

A good option to use is the time interval option which clears all layer cache at the specified interval. This is optimal for most dynamic content like weather. We can set an update, say every 15 minutes, and cache will be cleared and refreshed at the specified interval. When the map is saved and reopened, the layer will automically refresh its cache and then updated at the specified interval.

Using these choices you can ensure you’ve got both the best performance and are viewing the most up-to-date content.

Another way you can refresh cache is manually by using the Layer Manager (Tools > Manage Layers).

Highlight the layer and click Clear Layer Cache to remove all cache for that layer.

And a final way to remove cache is via Tools > Options > Cache > Disk Cache. Choosing All Caches and clicking Delete Caches will clear all your local ArcGIS Explorer cache. We covered this at the end of our previous post.

Posted in Uncategorized | Tagged | Leave a comment

ArcGIS Engine Java: Building a Multitemporal SDSS scenario viewer

The Summer 2008 edition of ArcUser magazine includes an interesting article on Spatial Decision Support System (SDSS) developed for the GLOWA IMPETUS research program that provides an integrated approach to the efficient management of scarce water resources in West Africa. Using ArcGIS Engine Java, comprehensive ArcGIS functionalities and partly remote sensing analysis are incorporated in the SDSS. Specifically, the SDSS includes a GIS tool for visualization called  the ArcGISDoubleMapPanel, which allows users to evaluate two multitemporal layers in one panel. This kind of functionality is not yet available in most GIS software and SDSSs.

The ArcGISDoubleMapPanel

The ArcGISDoubleMapPanel tool provides thematic and non-thematic raster and vector maps that can contain either two attributes and one time slider or one attribute and two time sliders (to compare two different time frames). Figures 1 and 2 contain screen shots of the ArcGISDoubleMapPanel tool during preliminary development of the SDSS. Two PageLayoutBeans, which have toolbars with common GIS tools and time sliders (for visualizing multitemporal time steps), are used. By displaying two feature layers with different attributes that are thematically mapped, the user can intuitively compare these attributes. A Java slider (JSlider) component, located below the two maps, allows the user to view changes in the scenario over time. This slider has access to multitemporal feature layers and provides different time increments. Using a processor that accesses the specific time step of the layer, the two maps of the ArcGISDoubleMapPanel are updated (using refresh) during run time. Based on the classification applied to the map, layers change color in response to movement of the time slider. In Figure 2, the ArcGISDoubleMapPanel displays feature data classified by one attribute. The user visually compares two maps from different time spans. This provides an easy way to detect change over time. Each PageLayoutBean has its own time slider.

Above:  Screen shots showing the ArcGISDoubleMapPanel with two attributes (in this case two vector layers) and one time slider.

 

Above:  Screen shots showing the ArcGISDoubleMapPanel displaying one attribute (population density) and two time sliders.

In addition to simultaneous visualization of multiple scenarios, the ArcGISDoubleMapPanel tool is also useful for performing change detection analyses, assessing current conditions and predicting future situations. To learn more about the SDSS, its architecture and implementation read the ArcUser article: Visualization, Interpretation and Evaluation

Contributed by the ArcGIS Engine Java Product Team.

 

 

 

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

Object initializers and the Geodatabase API

This post was provided by geodatabase product engineer James MacKay

A new approach to initializing objects was introduced at .NET 3.0: object initializers. These allow objects to be instantiated and initialized in a single line, provided the class has a constructor with an appropriate accessibility level. An instance of an ESRI.ArcGIS.Geometry.Point can be created using the following code at .NET 3.0:

IPoint point = new PointClass { X = 3.5, Y = 5.8 };

There are numerous places in the Geodatabase API where this is handy, especially where multiple interfaces are required to initialize an object that would otherwise require casting (i.e. using IQueryFilter and IQueryFilterDefinition to initialize a query filter). Here are a few key examples:

IQueryFilter queryFilter = new QueryFilterClass { WhereClause = “PID > 40″, PostfixClause = “ORDER BY PID” };

IDatasetName datasetName = new FeatureClassNameClass { Name = “Parcels”, WorkspaceName = wsName };

ILine line = new LineClass{ FromPoint = point1, ToPoint = point2 };

There are some situations where this approach should be avoided, however:

  • When property assignment can raise an error; using object initializers can complicate debugging.
  • Where there are several inherited interfaces implemented by the class, i.e. Field objects. Due to the way members are named at the class level, the code can become difficult to read.
Posted in Geodata | Tagged , , | Leave a comment

Customizing the map progress bar in the 9.3 Web ADF (.NET)

The Web ADF includes a progress bar that displays when the map is loading map images or tiles. It makes the user aware that the site is processing the user’s request. You may wish to customize the progress bar, either to modify it or to replace it with your own progress indicator. An earlier blog post described how to do this at the 9.2 version. Things have changed for the 9.3 version, and this post gives some tips on customizing the progress bar for 9.3.

We will cover two options for customizing the progress indicator. First, you can set some of the properties of the existing progress bar. Second, you can completely replace the progress bar with your own custom progress indicator. The second option involves working with custom progress events, which we will discuss before we get to the actual replacement of the default progress indicator.

Setting progress bar properties

At the 9.3 release, two public properties are exposed that you can set for the standard progress bar. These properties are the alignment, or location, of the progress bar on the map; and whether to enable or disable the progress bar. More properties may be exposed at future service packs or versions. We will use the enable/disable property later in this article, when we replace the progress bar. Let us look now at setting the alignment property, which will introduce a client-side approach we will use throughout this article.

The alignment property may be set using the Web ADF JavaScript Library. The Web ADF contains both code that runs on the server and code that runs on the client. The server-side code uses an ASP.NET language (C# or VB). The client-side code uses JavaScript, so we use that language to customize how the client code works. You can find documentation on the Web ADF JavaScript Library in the ArcGIS Server Developer Help, available either installed on your development computer, or online at the ESRI Resource Center. See the topic Web ADF JavaScript Library under the heading Developing Web applications using the Web ADF.

The progress bar properties are on the Map, since the bar is tied to the Map. Most of the properties and methods for the Map class are actually on the MapBase class, which the Map class extends. If you look on the class properties for MapBase, you will find the progressBarAlignment property. You will notice that, like most other properties, the documentation actually shows two methods associated with this property: get_progressBarAlignment() and set_progressBarAlignment(). As you will see in the code, we use these methods rather than the property per se when setting the propery.

The set_progressBarAlignment() method takes one argument when you call it: a ContentAlignment setting. For information on this enumeration, you can click on the ContentAlignment link on the progressBarAlignment page in the help, or find it under the ESRI.ADF.System namespace in the Web ADF JavaScript Library documentation. The ContentAlignment enumeration has nine values, corresponding to nine positions on the map. They include TopLeft, MiddleCenter, and BottomRight (the default).

Now we have the information we need to set the progress bar’s alignment. To demonstrate, we will set the progress bar alignment to the MiddleCenter of the map. To do this, we add some JavaScript code into the .aspx page for our application, typically the Default.aspx page. Near the bottom of the page, just before the closing </body> tag, add a JavaScript function that will be called when the page starts up. We can do this using the ASP.NET AJAX add_init function, which guarantees our function will run after the page completely loads. We pass to add_init the name of the function (setupProgressIndicator) that will be called on startup.

In the setupProgressIndicator function, we get a reference to the JavaScript component for the map, using the ASP.NET AJAX $find function. Then we set the progress bar alignment using the ContentAlignment value we want. The resulting code would go into your .aspx page, just before the closing </body> tag.

<script language="javascript" type="text/javascript">

// Have our custom function called when the user starts the application
Sys.Application.add_init(setupProgressIndicator);

function setupProgressIndicator() {

// Get the JavaScript map component
var map = $find('Map1');

// Set the location of the progress bar
map.set_progressBarAlignment(ESRI.ADF.System.ContentAlignment.MiddleCenter);
}

</script>

Custom progress events

If you want to do more than set the alignment of the built-in progress bar, you can have custom code that runs when the map is loading images or tiles. You can use this approach to supplement the standard progress bar, or completely replace it with your own indicator. The map’s onProgress event enables us to run custom code. This and other map events are discussed in the Web ADF JavaScript Library section of the Developer Help. In this section, we will use this event to display the number of pending tiles on the progress bar. Later we will replace the progress bar with a custom indicator.

To show custom content when the map is loading images or tiles, we can use the onProgress event on the map client. This event is new at 9.3, and replaces multiple events that were used at 9.2 (onRequestsPending, etc.). When a function is attached to the onProgress event, it gets called each time the number of pending tiles changes. The custom function takes two arguments: the sender of the event, which is the map component; and the number of pending tiles. You can check the second argument to determine what to display to the user.

In the code sample below, we attach to the onProgress event by calling the map’s add_onProgress method. We pass it the function to be called when the number of pending tiles changes. In this function, showProgress, we examine the number of tiles as given in the args value. If the number is greater than zero, then we display the number of tiles in the browser’s status bar. If the number of tiles is zero (i.e., the map is finished loading tiles), then we hide the status bar message.

<script language="javascript" type="text/javascript">

Sys.Application.add_init(setupProgressIndicator);

function setupProgressIndicator() {

// Get the JavaScript map component
var map = $find('Map1');

// Set the location of the progress bar
map.set_progressBarAlignment(ESRI.ADF.System.ContentAlignment.TopLeft);

// Add the custom progress function
map.add_onProgress(showProgress);
}

// Custom progress function
// sender = map component, args = number of pending tiles
function showProgress(sender, args) {

// If tiles pending, display number in status bar
if (args > 0) {
window.status = "Pending map tiles: " + args.toString();
} else {
// All tiles loaded - hide status bar message
window.status = "";
}
}

</script>

Custom progress indicator

Finally, we look at how to completely replace the existing progress bar with a custom indicator. The steps are: (1) turn the standard progress bar off; (2) create our custom progress indicator; and (3) turn on and off our custom indicator using the onProgress event described earlier.

The best way to turn off the standard progress bar is to use the EnableProgressBar property on the ASP.NET Web control. You can set this in Visual Studio by switching the page to Design view, selecting the Map control, and setting EnableProgressBar to False in the Properties window. Or, you can scroll up in the Source view to the Map control and add the EnableProgressBar property there, like this:

<esri:Map ID="Map1" runat="server" Height="423px"  
MapResourceManager="MapResourceManager1" Width="554px"
EnableProgressBar="False" >
</esri:Map>

Second, we’ll create our custom progress indicator. This indicator can be as simple or complex as you wish. An animated GIF image is common, but you could write a custom indicator similar to the built-in progress bar, which uses multiple divs and styles to create an animation. For our example, we will use the ajax-loader-circle.gif image, which is included with several samples in the Web ADF developer samples, such as ArcGIS_Spatial_Query_SOE. We copied this gif into our Web application folder and added it into the .aspx page within a div. We set the style position of the div so that it is approximately centered on the map control. Of course you could add code to dynamically position the progress indicator over the map, such as by getting the map’s offsetLeft/offsetTop and setting the progress indicator’s style position (see the zip file for the sample for an example of this).

<div id="progressImageDiv" style="position:absolute;left:250px;top:320px;">
<img id="progressImg" src="ajax-loader-circle.gif" alt="Loading..." />
</div>

Third, to show and hide our custom progress indicator, we use the same approach with the onProgress event as above. If tiles are pending (args > 0), then we show the progress indicator; otherwise we hide the indicator. To show/hide the indicator, we could add code to get the indicator div and set its style.display property. But the Web ADF has built-in functions to show or hide a div section, which we will use instead: showLayer and hideLayer. The complete code, with both the custom progress indicator and status bar text, is shown below.

<div id="progressImageDiv" style="position:absolute;left:250px;top:320px;">
<img id="progressImg" src="ajax-loader-circle.gif" alt="Loading..." />
</div>

<script language="javascript" type="text/javascript">

Sys.Application.add_init(setupProgressIndicator);

function setupProgressIndicator() {

// Get the JavaScript map component
var map = $find('Map1');

// Add the custom progress function
map.add_onProgress(showProgress);
}

// Custom progress function
// sender = map component, args = number of pending tiles
function showProgress(sender, args) {

var progressImageDiv = $get("progressImageDiv");

// If tiles pending, display progress indicator and tile number in status bar
if (args > 0) {
window.status = "Pending map tiles: " + args.toString();
progressImageDiv.style.display = "block";
} else {
// All tiles loaded - hide progress indicator and status bar message
window.status = "";
progressImageDiv.style.display = "none";
}
}

</script>

The code produces something like this when the progress indicator is displaying:

Customized progress bar

The complete code for this sample is available in this zip file. The code includes a few enhancements to the code above, such as an option to recenter the custom progress indicator if the map is resized, which may occur with the Web Mapping Application template. You can also try out this sample with the link provided.

Conclusion

We have seen how to customize the progress indicator for the map, both by setting properties of the standard progress bar and by adding our own custom event handling to display information or even a custom progress image. The map has other events and properties that you could use for performing custom handling on the client. See the Web ADF JavaScript Library reference in the Developer Help for further information.

Try the example application

Get the code

Contributed by Bryan Baker of the ArcGIS Server .NET software development team.

Posted in Services | Tagged , , , , | 5 Comments

ArcGIS Online Resource Center improvements

11/7/08—The ArcGIS Online Resource Center was updated on November 6, 2008, to make it easier to learn about the content available for use with your GIS applications:

  • Content tab: Learn about free maps, premium maps, and premium data products; compare the available imagery and street map services; and preview featured online content.
  • About tab: Find information about ArcGIS Online including advantages of using ArcGIS Online content, FAQs, available maps and data, Content Sharing Program, tasks, and system infrastructure. Information on available maps includes a description of the types of maps available, details on how to use free and premium maps, a licensing summary, map tiling scheme information, and common map attributes.
  • Blog tab: Learn about new content and updates to existing services.

NOTE: If you bookmarked links to any of the service descriptions, you need to update your bookmarks. The URLs for the service descriptions have changed.

Posted in ArcGIS Online, Services | Comments Off

Lidar Solutions in ArcGIS_part1: Assessing Lidar Coverage and Sample Density

This blog post is written by Clayton Crawford, Product Engineer in the Software Products Group’s 3D Team in Redlands.

This post is the first in a series called “Lidar solutions in ArcGIS”. The series will cover Lidar processing tasks and workflows. And it will show you how to manage these vast point collections and outline approaches for mining information from them.

Let me state an important point up front: This series is about Lidar point processing. If you have Lidar derived raster data then it won’t be of direct use, but if you need to learn how to make those rasters then read on. Also important to note: the type of Lidar involved in this discussion is collected from plane or helicopter with a laser scanner pointed downward. With this type of Lidar you can make bare earth surfaces for topographic mapping and 1st return surfaces that include vegetation and buildings. It’s not about the type of Lidar where data is collected at side-on angles.

Note that some of the tasks covered in the series require a 3D Analyst extension license.

Here are the topics I plan to cover:

 

Lidar Solutions in ArcGIS_part1: Assessing Lidar Coverage and Sample Density

One basic QA/QC process is to ensure the Lidar points delivered by your data provider have the coverage and density expected. You want to catch problems with this early on and have them resolved before continuing. Two geoprocessing tools are useful in this regard: Point File Information found in the 3D Analyst toolbox and Point To Raster located in core Conversion Tools.

Point File Information
The Point File Information tool reports basic statistics about one or more point data files on disk. The tool’s primary purpose is to help you review and summarize the data before loading it into your geodatabase.  LAS (the industry standard format for Lidar data) and ASCII format files are supported as input. Since Lidar projects often utilize collections of data files, sometimes in the hundreds or even thousands, the tool lets you specify folder names in addition to individual files. When given a folder, it reads all files inside it that have the suffix you specify.

 

For each input point file it outputs one polygon with accompanying attribution to a target feature class. The polygon graphically depicts the xy extent, or bounding box, of the data in the file. Attributes include file name, point count, z-min, z-max, and point spacing.

 

The point spacing reported by Point File Information is not exact and deserves some discussion. For the sake of performance it uses a rough estimate that simply compares the area of the file’s bounding box with the point count. It’s most accurate when the rectangular extent of the file being examined is filled with data. So, files with significant numbers of points excluded over large water bodies or on the perimeter of a study area, only partially occupied with data, will not have accurate estimates. Therefore, the reported point spacing is more meaningful as a summary when looking at trends for collections of files. Something useful to do with the output feature class is to display it in ArcMap, open its attribute table, and sort the point spacing field in ascending order. You can also symbolize on the point spacing field using a graduated color ramp.

 

Point File Information works quickly on LAS files because it only needs to scan their headers to obtain the information it’s looking for. It takes significantly longer with ASCII files because with them the tool actually has to read all the data.

Assuming everything checks out OK, the next thing to do is load your Lidar points into a multipoint feature class with the LAS To Multipoint or ASCII 3D To Feature Class tools. Put this feature class in a feature dataset if you intend to build a terrain dataset from the points. While you have the choice between using LAS or ASCII format files, LAS is generally a better way to go. They contain more information and, being binary, can be read by the importer more efficiently.

Once the points are loaded into a multipoint feature class you can use the Point to Raster tool to get a more in-depth view of the point distribution.

Point to Raster
The Point to Raster tool creates rasters from points and it also supports multipoints. It’s a generic tool with many options and uses. For the sake of evaluating Lidar point density the tool’s COUNT option is the thing to go for. This uses the number of points falling in a raster cell as the cell value. Being able to look at this graphically over the extent of the project area is revealing.

There’re a couple parameters on the Point to Raster tool whose values for this exercise aren’t obvious. First, is the Value Field parameter. It doesn’t matter what this is set to. That’s because the Value Field is ignored when the Cell Assignment type is set to COUNT. Then there’s the cellsize. You might think the average point spacing is good but this typically results in too many empty, or NoData, cells because Lidar points just aren’t that evenly spaced. Also, the output raster could end up being unnecessarily large. Instead, it’s better to go with a cellsize that’s several times larger than the average point spacing but small enough to identify gaps or voids that warrant further investigation. A reasonable size is four times the point spacing. As an example, let’s say your data is sampled at 1 meter. If you set the cellsize to 4 then you can expect, on average, to get 16 points in a cell.

You can also evaluate the density for different types of points. While most of the time you’ll probably just check the density for all returns it can be useful to look at those that fall in a certain class like ‘ground’. For example, this can give you an idea of how good your ground penetration is in vegetated areas. The Point to Raster tool doesn’t know how to make the distinction between point types though. So, you control what points get used by how you go about creating the multipoint feature class with the LAS To Multipoint tool. It provides options for loading points by class code and return number.

Once your raster has been created have a look at it in ArcMap. Use a color ramp renderer to display it so it’s easy to distinguish between cells with high counts and those with low. You can also set the NoData color to something that stands out. Look for variance in density and data voids. Have your vendor explain anything that doesn’t look right.

Hopefully, you’ll find your data meets specifications and lacks surprises. It’s worth the effort to check.

That’s it for this installment of Lidar Solutions in ArcGIS. Subscribe to this blog or check back in a couple weeks for a discussion on the creation of raster DEMs/DSMs from Lidar.

 

Posted in Analysis & Geoprocessing | Tagged , , | 2 Comments

Explorer on The Weather Channel

This Weather Channel article reviews the 2008 severe weather season, and makes for a very interesting, if sobering, read.

We noted that the 4th graphic in the article shows ArcGIS Explorer displaying a tornado path across downtown Atlanta, and was produced by the National Weather Service. 

Posted in Uncategorized | Tagged | Leave a comment

Your Cache Portfolio – Part 1

You should see your investment advisor about investing cash, but in this two part post we’ll cover how you can best manage your investment in Explorer map cache. Under most circumstances cache and how it is managed are completely internal to the application. But knowing a little more about it will help you make the right decisions about managing your own cache, and in making decisions about how you connect to services. 

We’ll begin by covering the implications of cache as it pertains to the default map, and other maps and layers you can access from the Content tab on the Explorer Resource Center.

Behind the scenes the default map and other maps are powered by ArcGIS Online, a large repository of online content and services that can be used in ArcGIS Explorer, ArcGIS Desktop, and ArcGIS Server. The ArcGIS Online services are powered by ArcGIS Server, and use ArcGIS Server’s caching capabilities to streamline performance, and reduce client/server overhead. The ArcGIS Server 9.3 Help describes caching as follows:

Map caching is a very effective way to make your ArcGIS Server maps run faster. When you create a map cache, the server draws the entire map at several different scales, and stores copies of the map images. The server can then distribute these images whenever someone asks for a map. It’s much quicker for ArcGIS Server to hand out a cached image than to draw the map each time someone requests it. Another benefit of caching is that the amount of detail in the image doesn’t noticeably affect how quickly the server can distribute the copy.

The bottom line is that caching is a feature of ArcGIS Server that makes things better for you – the ArcGIS Explorer user.

When you first connect to a service you communicate with the ArcGIS Online’s ArcGIS Servers. Cache is “handed out” to Explorer, and you’ll see the Streaming… progress bar at the bottom of the map.

What’s happening is that cache is being transferred from the ArcGIS Online servers to Explorer, where it’s stored locally. This is somewhat similar to how bits and pieces of internet sites you visit are stored in browser cache to optimize performance when visiting the site again.

Once local, the next time you visit the same location Explorer doesn’t even have to communicate with the server. It knows that it already has the cache it needs and simply uses it from local storage, resulting in best performance and minimizing client/server communications.

In an earlier post we blogged about how Explorer’s default startup map and other layers you find on the Resource Center are regularly updated. To see these updates in areas that you’ve already visited you will have delete your local cache since Explorer knows you’ve already been there, and doesn’t fetch new cache from the server.

But now that we said that, it’s not entirely accurate. There were many changes in ArcGIS Online services in recent months that were automatically propagated to all Explorer users. That happened since we changed the ArcGIS Online server URL string to indicate a migration from the 9.2 version of ArcGIS Server to the 9.3 version. As a result of that change, new cache was pushed out automatically. But unless ESRI does something on the back end, some changes may be made to ArcGIS Online services that you’ll need to refresh your cache to see.

To refresh your cache, just go to Tools > Options > Cache and choose Disk Cache. Check the option for All Caches and click Delete Caches.

It’s a good idea to periodically refresh your cache, and good practice to make it part of your housekeeping activities.

In Part II, we’ll cover how to have your cache refresh automatically when connecting to services.

Posted in Uncategorized | Tagged , | Leave a comment

ArcGIS Developer Poll Results

Here are the results from the last poll.  It looks like 76 people participated, and more than 50% have already migrated from to .NET, and about 30% are still transitioning from VBA/VB 6.0 to .NET.

Thanks for participating!  There’s a new one today and there will be more to come…

EDN Team

 

 

Posted in Developer | Tagged , | Leave a comment

Adding columns to text boxes

By Matthew Baker, Esri Software Engineer

As a judge for the Map Gallery at the Annual Esri International User Conference, and the Cartographer for the Esri Map Book, I am fortunate enough to see what many of you are doing with ArcGIS to create printed maps.
This year, one issue I frequently noted was very wide columns of text.  Below is an example, and the reason it doesn’t work is that it is hard to make your eye track along the long lines of text and then reliably find the next line. As presented, the text below almost guarantees that nobody will bother reading all the text that the Mapping Center team worked so hard to write.

Continue reading

Posted in Mapping | Tagged , , | 2 Comments