Posted by: Jeff Germain | May 3, 2011

Consuming Esri’s new Landsat ImageServices in Flex

Esri’s recent release of world-wide Landsat data via image services is pretty sweet. Sweeter yet are the apps built around those services to compare and explore them. To get the most out of those services you’ll want to take advantage of the MosaicRule property on the ArcGISImageServiceLayer. The mosaic rule allows you to control which rasters should be rendered, their ordering, and how overlapping pixels are resolved between rasters.

Here’s an example pulling in their Healthy Vegetation dataset. First, we’ll spin up the layer.

var url:String = 
  "http://imagery.arcgisonline.com/arcgis/rest/services/LandsatGLS/HealthyVegetation/ImageServer";
var imageLayer:ArcGISImageServiceLayer = new ArcGISImageServiceLayer(url);
imageLayer.id = "HealthyVegetation";

Next, we’ll apply the mosaic rule.

UPDATE:  The latest version of the ArcGIS API for Flex 2.3.1 fixes issues with the MosaicRule. Previously, properties not set were sent along to the REST API as “null” values which are not currently supported. Now, null properties are no longer sent to the REST API.

var rule:MosaicRule = new MosaicRule();
rule.method = MosaicRule.METHOD_ATTRIBUTE;
rule.sortField = "AcquisitionDate";
rule.sortValue = "3000/01/01";
rule.ascending = true;                     
rule.operation = MosaicRule.OPERATION_FIRST;
rule.where = ""; // if left empty; i.e. null, REST API fails @ 10 SP1

imageLayer.mosaicRule = rule;

With this rule, we’re specifying that the most recent imagery be displayed on top. Now, these services are “time aware” and their catalogs contain imagery from 1975, 1990, 2000 and 2005 (known as epochs). So, using the code above will render imagery for the 2005 epoch on the map.

But what if we wanted to see healthy vegetation for 1990? Perhaps flip back and forth between the two epochs to compare change over time? Simple. Just tell the layer to respect the time extent on the map as follows.

imagerLayer.useMapTime = true;

Then set the timeExtent on the map manually or via the TimeSlider component.

Anyways, head over to their Landsat page and see their apps and services.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: