• New Lens Dijit for the ArcGIS API for JavaScript

    Yesterday I added a new dijit to the ArcGIS API for JavaScript Code Gallery: the Lens Dijit. It could also be called an X-Ray dijit. Here's a screen shot:

    Everything you need to get started using it is in the ReadMe.txt included in the download but, if you just want to take it for a spin, you can try it here:  lens dijit demo.

    Please leave any feedback in the comments here or at the resource center.

    Contributed by Derek Swingley.

  • More Microsoft Surface Videos

    This week we have four new videos of proof-of-concepts developed on the Microsoft Surface with ESRI’s ArcGIS API for WPF.

    ArcPhoto for Microsoft Surface

    This application demonstrates how photographs can be automatically downloaded from a camera to the Surface using Bluetooth connectivity and georeferenced.  Georeferencing is the process of assigning a physical real-world position to an object, namely a photograph.  In this demonstration, the photographs were taken using device that included a GPS receiver and could tag photographs with their geographic position.

    Greenprint Priority for Microsoft Surface

    The following demonstration uses the Surface to display a map of an area and instructs a remote mapping server to perform intensive suitability analysis.  The parameters for the analysis are on the right hand side of the screen and the results are displayed on the left.  This demonstrates how the Surface can be used to perform “what if” environmental analysis.

    Map Analysis with Tagged Objects for Microsoft Surface

    This demonstration uses Surface-specific tags as inputs to drive time and viewing geoprocessing operations.  The geoprocessing analysis is being performed on a remote ArcGIS Server.

    Tag Map Magnifier for Microsoft Surface

    The application utilizes Surface-specific tags to act as virtual map magnifiers.  Tags are made up of a collection of domino-like black dots and are uniquely identified by the Surface device.  Developers can retrieve the tag position, identifier code and orientation.

    The lab used the tags to add an additional Map UIElements to the display.  As the user manipulates the tag, the magnifier map is repositioned and its map extent updated.  The map insets initially have same scale as the base map, a small scrollbar is provided to allow the user to magnify the map (or “zoom in”).

    Because tags are uniquely identified, if a user removes a tag and then places it back on the table, we are able to restore previous settings such as the map magnifier’s size and relative scale.

    Contributed by Richie C.

  • Dynamic Charting for ArcGIS Desktop

    This post describes a new sample published by ESRI’s Application Prototype Lab and inspired by Jack Dangermond’s geodesign presentation at the 2009 ESRI International User Conference.

    Dynamic Charting for ArcGIS Desktop is a free sample (with source code) available from the ESRI code gallery.  The sample summarizes a layer’s features based on length or area and grouped by unique values from the renderer.  The differentiating factor between this sample and the out-of-the-box charting tools is that these charts update dynamically, even during editing operations.

    The screenshot below demonstrates the Dynamic Charting tool in use during an active edit session.  As the user digitizes landuse lines and polygons, pie charts summarizing these two layers are automatically updated.  The benefit of this sample is that it allows the ArcMap user to view the proportion of features, for example, major roads versus minor roads, easily and dynamically.

    Installation Prerequisites

    1. Microsoft .NET 3.5 SP1
      Installer will direct you to the Microsoft download website if this is missing.
    2. ESRI ArcGIS Desktop 9.2/9.3/9.3.1
    3. ESRI .NET Support
      http://mrrichie.spaces.live.com/blog/cns!DD16C3F34F4D913E!582.entry

    How to install?

    1. Download the contribution from ArcGIS Desktop code gallery,
    2. Unzip the download,
    3. Double click on the setup program (.msi) and following the installation instructions.

    How to use?

    1. Start ArcMap,
    2. Add a feature layer
      eg shapefile, geodatabase feature class
    3. Select a unique value renderer
      - Right click on a layer, select properties,
      - Click the Symbology tab,
      - Click Categories > Unique Values
      - Select a Value Field,
      - Enter values or click "Add All Values"
      - Click ok.
    4. Display the Dynamic Charts toolbar
      - Click View > Toolbars > Dynamic Charting
    5. Click the first (and only button) on the toolbar,
    6. Drag and drop a layer to the Dynamic Charting dialog,
    7. Modify the refresh rate (if necessary)

    Where to download?

    Dynamic Charting for ArcGIS Desktop can be download from here.

    Contributed by Richie C.

  • Site Suitability for Microsoft Surface

    During the 2009 ESRI International User Conference, Jack Dangermond introduced his vision of geographic design or “geodesign”.  Click here to view Jack’s presentation of his geodesign vision.  To assist Jack’s presentation, a few demonstrations were created to help illustrate this vision.  One such demonstration used a Microsoft Surface device to sketch planning areas on an interactive map.

    This application was developed using the ArcGIS API for WPF by the Applications Prototype Lab.  The base map is from ArcGIS Online and the overlaid suitability maps were sourced from a local ArcGIS Server.  In summary, this application demonstrates the interactivity of a multi-user/multi-touch device for planning and communal design.

    Contributed by Richie C.

  • Point Data, ArcGIS Server Base Maps and KISS

    One of the most common requests for a web mapping application is to simply display points on a map. I won’t go on and on about the general concept as we’ve all probably seen countless examples of these maps. The basic idea is point data are represented by icons that are clickable. When you click a point, you get info about what’s happening there. It’s just simple points on a map.

    A few months back, a couple of us in the lab were tasked with developing a simple workflow that we could publish as a quick and easy way for non-developers to display some of their data on ArcGIS Online (or any other ArcGIS Server) base maps. KISS was definitely the theme of this mini-project. We quickly came up with a solution, and eventually uploaded it to the ArcGIS API for JavaScript code gallery under the title “Mapping Point Data.” See the default, dead simple, points on a map app here.

    There are two applications bundled in that sample but both serve the same purpose. For this post, I’ll only go into detail for the app that deals with data that already have x and y coordinates. The apps come with detailed “How To” documents that serve as a step-by-step walkthrough to get the app running with your data.

    When working with data that already have associated x and y coordinates, the basic workflow is:

    • download and unzip the file from the code gallery page for this app
    • edit the app’s configuration file, appConfig.js, to reference your data and the necessary fields
    • copy the edited configuration file, your data file and the html file from the original .zip file to your web server

    That’s it! Navigate to the html file on your server and you should see your data displayed on a base map. The default configuration will display your data on top of the ArcGIS Online (AGOL) street map but you can easily change this by editing the configuration file to point to a different AGOL map service or a map service of your own. Below is a screen shot displaying some of the sample data included with the code.

    Of course, you can get into more complex scenarios. One that’s covered in the “How To” doc is using/displaying data from multiple files. And there might be some pre-processing required to make sure your data uses the correct coordinates. If you just need to do a simple conversion from WGS84 to Web Mercator (or vice versa), check out geographicToWebMercator() or webMercatorToGeographic().

    If you run into any issues using these apps and/or have questions, please let us know in the comments.

    Contributed by Derek Swingley.

  • No Download Required: View Data.gov Shapefiles Directly In Your Browser

    We recently submitted the Shapefile Viewer application to the Apps for America 2: The DATA.gov Challenge contest, a project of the Sunlight Foundation. We believe DATA.gov is a great resource of publicly available government data. With the recent addition of the geodata.gov references to the DATA.gov site, we now have over 100,000 geospatial datasets and services available for searching, browsing and/or download.

    In the ‘Raw Data Catalog’ and ‘Geodata Catalog’ sections there are many zipped data files available for direct download, including many Shapefile datasets. Typically, if you want to use these Shapefile datasets, you first need to download the zip file, unzip the contents to your local machine, and then finally view the Shapefile dataset with your favorite GIS. Unfortunately, there are times when the metadata associated with each entry does not provide enough information for you to decide if a particular Shapefile dataset is the one you’re really looking for. We also realize that not all DATA.gov users have a GIS application that supports the Shapefile format, but they’re still interested in the data.

    Ideally you’d want to look at the Shapefile dataset before you decide to download it to your local machine. This is where the Shapefile Viewer application comes in: it allows you to visualize and query these Shapefile datasets directly in your web browser, allowing you to decide if a particular Shapefile dataset is the one you’re looking for.

    The Shapefile Viewer web application relies on a Geoprocessing Service to do the hard work. The web application simply sends the URL of the user selected zip file as an input parameter to the Geoprocessing Service. The Geoprocessing Service is responsible for downloading the zip file remotely, unzipping the contents, fixing the Shapefile datasets, creating a map document, creating and rendering layers, and publishing a map service. Once the map service is created on the server, the Geoprocessing Service sends back the URL of the new map service to the web application. In the final step in the process, the web application adds the new map service to the map and allows the user to query the Shapefile dataset by identifying features on the map.

    Contributed by John G.

  • Custom Objects in dojo.ItemFileReadStore: Using a Type Map

    The GeoChalkboard Blog recently published a post about using the dojo.ItemFileReadStore (IFRS). That post does a good job of introducing and discussing basic usage of the ItemFileReadStore, but it leaves out one important aspect, the Type Map.

    Natively, an IFRS allows you to store primitive JavaScript types such as strings and numbers. If you want to store custom objects within an IFRS, geometry for instance, then you need to tell dojo a little about the objects and provide some extra info in your JSON file.

    You tell dojo about your custom objects through a Type Map. The documentation about Type Map is comprehensive and does a good job of explaining the various options. I recommend sticking with the simplified form. The Type Map itself is a property of an object that is passed into the IFSR constructor. In its simplest form, the value for Type Map is an object that contains custom type names as properties and constructor functions as values. Simple, right? The following example should clear up any confusion.

    Here’s some code I used in a dijit I built to zoom to a specific state and/or county:

    this.stateStore = new dojo.data.ItemFileReadStore({
    url: dojo.moduleUrl("apl.dijit.ZoomTo", "data/states_wgs84.json"),
    typeMap: { "Extent": esri.geometry.Extent }
    });

    The code above is setting up an ItemFileReadStore from which you can retrieve extents. It would be nice if all you had to do was specify the Type Map, but, unfortunately, it’s not that simple. To successfully use custom types in an IFRS, you also need to specify the object type within your JSON. Each custom object needs two specific properties: _type and _value. _type has to match a property name in the Type Map object and _value is passed to the custom type constructor function. Here’s an excerpt from states_wgs84.json file:

    {
    "identifier":"name",
    "label":"name",
    "items":[{
    "name":"Alabama",
    "abbr":"AL",
    "fips":"01",
    "extent":{
    "_type":"Extent",
    "_value":{
    "xmin":-88.4729522509999,
    "ymin":30.2336047200001,
    "xmax":-84.8940162469999,
    "ymax":35.0160337240001,
    "spatialReference":{"wkid":4326}
    }
    }
    }
    }

    Notice that the value for _type from the JSON file matches a property of the typeMap used in the IFRS constructor. Once you have custom types defined in a Type Map, and set the proper values for _type and _value, you can retrieve and use custom types like any other type coming from an ItemFileReadStore. The code below retrieves a single extent from the store using fetchByIdentity:

    this.stateStore.fetchItemByIdentity({
    identity: placeName, onItem: this.handleExtent, onError: this.oops
    });

    To see a complete working example of creating and using custom types in an ItemFileReadStore, see the ZoomTo.js file that is a part of the Zoom To State/County Dijit.

     

    Contributed by Derek Swingley.

     

  • Cross Country Mobility for Microsoft Surface

    This Surface application is built with ESRI’s ArcGIS API for WPF and references map and geoprocessing services from ArcGIS Server.  Cross country mobility is the name giving to an exercise of determining the most efficient path between two locations.  Depending on the data (and parameters) the end user can find a route that is the fastest, shortest, most fuel efficient, avoids urban areas, flattest or any other condition.

    The first step illustrated in the video is the rating of three geographic layers: slope, vegetation and transportation.  The user can assign a preference to weight one more than others.  For example, slope could be a larger consideration (e.g. if moving heavy equipment) than the vegetation type.  Secondly, items within each layer can also be rated.  For example, the user can indicate that low slope is preferable to steep slopes and that grades great than 40° are “no go” (or impossible to traverse).

    The next step is to indicate the intended target location for the three flagged vehicles/people/units.  In the demonstration video the target is represented by a bulls-eye button than can dragged into position.

    After the three geographic layer have been rated and the target placed into position, a request is sent to ArcGIS Server to perform a weighted overlay using the user defined parameters.  The result is a new geographic layer called a cost surface.  A cost surface is like an image where each pixel contains a cost value, that is, the cost for an object to traverse it.

    The next step, uses the cost surface to find the least cost path from the three flagged objects to the target.

    The final step is the creation of a cost corridor.  A cost corridor is an area around the least cost path with a plus or minus one, two and three percent variation.  Basically, what alternative path could the three flagged objects take by sacrificing one to three percent cost (in time, money, fuel etc).

    Contributed by Richie C.

  • Police Dispatcher on Microsoft Surface

    In May 2009, the Applications Prototype Lab published a web application called “Police Dispatcher”.  The application simulated a police dispatch system with real time incidents and the tracking of police vehicles.  The application was built using Silverlight 2 and the ArcGIS API for Silverlight.

    The police dispatcher demonstration was recently ported to the Microsoft Surface as a Surface application.  Surface applications are similar to standard WPF application except that they target the Surface hardware and include references to a few extra libraries.  The transition was relatively trivial, for example, the application references the ArcGIS API for WPF rather than the ArcGIS API for Silverlight.

    In the Surface application we took advantage of some the goodness of WPF such as drop shadows and glow bitmap effects.

    Contributed by Richie C.

  • Reading Remote XML Data Stores in .NET

    I’d like to talk about difficulties you may encounter when retrieving and using GeoRSS (or in fact any XML data) in an application built on the .NET framework—including those built with the new ArcGIS API for Silverlight/WPF. The basics of using XML feeds involve:

    1. Constructing a URL pointing to the data location;
    2. Using a .NET framework object, such as WebClient, to read the data;
    3. Decoding the XML data and doing something with it

    Using the ESRI Proxy Page

    The first roadblock you’ll run into is that of cross-domain security—that is, when your base map data is on one server (e.g. ArcGIS Online) but the XML data you want is on another. This is considered a security risk and is generally forbidden by web browsers and network-access object models such as those in Microsoft’s Silverlight or Adobe’s Flex.

    A couple of solutions are:

    • Add an access policy file on the XML server as documented near the bottom of this page.
    • Use a proxy page to access the data, as documented here.

    The policy file is the easier solution, but it is not normally under your control as a developer. Setting up a proxy page involves downloading it and installing it into the web directory of your solution:

    To use it, use its local URL along with a query string parameter for the remote web page containing the XML data you want; for example: http://localhost/GeoNetworkCatalog.Web/proxy.ashx?http://geonetwork3.fao.org/geonetwork/srv/en/rss.search?georss=gml

    There are two question-mark parameter delimiters here; the first one is used by the proxy page to determine the real location of the XML feed. The second question mark is interpreted by the server hosting the XML data. This will trick the web browser into thinking the data you want is on the local web server, not on a remote and insecure domain.

    How do we use the proxy page to get data? .NET provides an object for this, called WebClient. Setting up the download involves just a few preparatory lines of code:

    // sURL is the proxy page plus URL for the remote GeoRSS feed

    Uri uriGeoRSS = new Uri(sURL, UriKind.Absolute);

    WebClient wcGeoRSS = new WebClient();

    // grss_HandleString is an event handler called when the data is available

    wcGeoRSS.DownloadStringCompleted += new DownloadStringCompletedEventHandler(grss_HandleString);

    wcGeoRSS.DownloadStringAsync(uriGeoRSS);

    What you do with the downloaded GeoRSS data is up to you. Your event handler will receive the feed data as XML, so you can use standard .NET XML objects to break it into usable bits:

    private void grss_HandleString(object sender,

       DownloadStringCompletedEventArgs args) {

          if (args.Error == null) {

             XElement xdocGeoRSS = XDocument.Load(

                new StringReader(args.Result)).Root.Element("channel");

     

                // Display header info

                hlPageLinkMain.Content = (string)xdocGeoRSS.Element("title");

                hlPageLinkMain.NavigateUri =

                   new Uri((string)xdocGeoRSS.Element("link"));

                // Etc...

    There’s a problem, however: the proxy page often fails to properly download XML data. So you may need to modify the page to handle GeoRSS XML properly.

    Modifying the ESRI Proxy Page

    If you’ve decided you need a proxy page to get XML data for your application, you may have downloaded and tried the ESRI proxy page.

    There’s a problem with the page as it’s implemented, and it’s in the one line that does all the work of the proxy page:

    byte[] outb = br.ReadBytes((int)serverResponse.ContentLength);

    The ContentLength property returns the value of the HTTP “Content-Length” header; but a quick web search shows that this property is commonly incorrect or missing. A more robust approach is to read data from the response stream until there’s none left:

    while ((array = reader.ReadBytes(4096)).Length > 0) {

          // Append this 4K chunk to the previously read chunks

    }

    The resulting modified is available here on ArcScripts..

    Local data and absolute URLs

    While developing your application, you’ll probably read your target XML data source many, many times; but you probably won’t need the latest data. You might want to temporarily use a static local snapshot of the data in order to avoid putting a heavy load on the remote server.

    The snag is that the WebClient methods need an absolute URL path, not a relative one. You could just hardcode the XML file’s web server location in your call to WebClient.DownloadStringAsync; or you could add a little code to convert a relative file path to an absolute URL location. There’s a short, useful blog entry on just this subject at the .NET Developer’s Journal website.

    This small routine will convert a local “file://” reference to an “http://” style reference. With this approach, it’s easy to use a local file in the same manner as a remote XML feed. And using conditional compilation statements, switching between local and remote sources is as simple as changing your project configuration from the Visual Studio dropdown list.

    There is, of course, much more involved in effectively accessing and using XML data in your .NET application. But hopefully these tips will help route you around some of the trickier snags in the process.

    Contributed by Mark D.

  • What would happen if the Earth stopped spinning?

    This map illustrates (the very impossible, but intellectually exciting) scenario of the Earth standing still.  If the Earth stopped spinning, the only remaining force that could affect our oceans is gravity.  Oceanic water would migrate to the polar regions where the Earth’s gravitation forces are strongest create two large polar oceans.  In a few areas, such as the Gulf of Mexico, the ocean’s water would pool to form giant inland seas.

    Following the global ocean shift, a new and enormous continent would form around the equatorial region.  The red line in the image below represents the global divide in hemispherical watersheds of the two great oceans.

    Contributed by Witold F.

  • Microsoft Surface Videos

    The Applications Prototype Lab at ESRI received a Microsoft Surface a few months ago.  The Surface is a vertical mounted multi-touch (and multi-user) screen.  Below are a list of recent prototypes developed for the Surface using (with one exception) the ArcGIS API for WPF.

    GeoEye Imagery Explorer

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. Background map content is provided by ArcGIS Online. The application displays footprints from GeoEye's satellite image catalog. The presenter demonstrates how to select and manipulate thumbnails of GeoEye imagery.

    Terrain Profile Computation

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. Background map content is provided by ArcGIS Online. This application display the terrain profile of a line drawn by the presenter on the surface. The terrain analysis is done using a remote geoprocessing service hosted by ArcGIS Server.

    <

    Message in a Bottle

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. Background map content is provided by ArcGIS Online. When the presenter touches a location on the ocean, a line drawn that displays where a object in the sea would travel in 365 days based on ocean currents. The analysis is being performed by a remote geoprocessing service hosted by ArcGIS Server.

    ArcGIS Engine Globe Control

    This video demonstrations an XNA application build for the Microsoft Surface using the ArcGIS Engine Globe control. The presenter shows how the Surface API has been used to control globe navigation and the use tagged values to change globes appearance or behavior.

    Drive Time Geoprocessing

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. Background map content is provided by ArcGIS Online. When the presenter touches the surface a request is sent a remote server running ArcGIS Server to perform drive time analysis. The results are then returned to (and displayed) on the Surface.

    CCM Analysis

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. In this example, the presenter is showing a geographic operation called "cross country mobility" with the aid of tagged objects. The objects represent parameters of units ability to traverse the cost surface.

    CalTrans Traffic Viewer

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. Background map content is provided by ArcGIS Online. The map displays push pins for CalTrans traffic cameras, when pressed, live camera images are displayed on the Surface.

    USGS Earthquake GeoRSS Feed

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. Background map content is provided by ArcGIS Online. The Surface map is displaying icons for recent earthquakes. The earthquake information is provide by a GeoRSS feed published by the USGS. When the presenter clicks on a earthquake icon, a request is sent to a remote geoprocessing service running on ArcGIS Server. The service returns the number of people within a hundred miles radio of the earthquake.

    ArcGIS Online

    This video demonstrates an application built for the Microsoft Surface using the ArcGIS API for WPF. Background map content is provided by ArcGIS Online. The presenter shows how the multi-touch surface can be used to navigate around the map. The presenter also shows an innovative "virtual magnifying glass" for revealing more detail.

    Contributed by John G.

  • Welcome to the Applications Prototype Lab Blog!

    The Applications Prototype Lab is a group working at ESRI's headquarters in Redlands, California. The group is tasked with winning competitive software competitions, conducting applied research and creating innovative proof-of-concepts. This blog will contain a variety of posts ranging from tips and tricks to recently completed prototypes. Overall we hope that the contents of this blog will be interesting, thought provoking and educational.