kelly

Recent Posts

Hardware accelerated map navigation with CSS3

One of the enhancements to the ArcGIS API for JavaScript at version 2.6 is the use of CSS3 transforms while panning and zooming a map. When enabled, there is a subtle animation and fade when images that make up tiled map layers are added to or removed from the map. You can see this in one of the simple SDK samples. This is similar to how the other ArcGIS web APIs, for Flex and Silverlight, operate.

There are both aesthetic and performance benefits from using the latest and greatest in CSS. Aesthetically, the transition between map levels is more pleasing due to a fade animation. For performance, some webkit and mobile browsers use hardware acceleration when a webpage uses CSS transforms. This is especially beneficial on older versions of iOS.

Like other new HTML5 and CSS3 capabilities, transforms are not yet consistently implemented across browsers. For a complete rundown of browser support, check out caniuse.com’s browser support chart for CSS3 transforms. While that’s a good reference, there are some subtleties to the current implementations. In Chrome on XP, there’s an existing bug that will hopefully be addressed by Chrome 17 in early 2012. For Firefox, version 10 (also due in early 2012) should bring full support for transforms.

Version 2.6 of the ArcGIS API for JavaScript uses CSS3 transforms by default where they’re supported. The API will automatically use CSS3 transforms for the following browsers:

Posted in Services | Tagged , , | Leave a comment

ArcGIS API for JavaScript – Basic Viewer template now available

We recently added a new JavaScript application template to
ArcGIS.com called the Basic Viewer. Using ArcGIS.com and the Basic Viewer
template, you can quickly create and publish applications with commonly
requested functionality such as a legend, basemap gallery and print tools. The
template includes many out-of-the-box widgets from the ArcGIS API for
JavaScript including the Editor, TimeSlider and Measurement widgets.
The Basic Viewer template is a fully configurable application that you can configure in ArcGIS.com or via a configuration file if you choose to download the template and host it on your
web server.

How to make a web application with the Basic Viewer

Create a Web application based on the Basic Viewer template
by performing the following steps:

  1. Open an existing map (or create a new one) using
    the ArcGIS.com
    map viewer
    . Use the map viewer to add layers, set an extent, configure map popups and add map notes. All of these settings are honored by the template and will appear in the application built using the template.
  2. Click the Share button and choose who can view the map. To publish the map as an application, you need to make the map available to a group, your organization, or the public.
  3. Click the Make
    a Web Application
    option to display a gallery of templates.
  4. Select Basic Viewer and use the Preview
    option to view your web map in the Basic Viewer template. The preview option is a great way to determine which template works best for your map.
  5. Close the preview window and select the Publish option for the Basic Viewer
    template to create a custom application based on the template. This published
    application is added to ArcGIS.com and can be shared with the public or with
    users in your group or organization.

If you would rather host the application on your own
web server, you can select the download option and download a zip file
containing the full source code for the template. The zip file contains
instructions for installing and configuring the template.

Configure the published template

After publishing the web map as an application, use the Configure App option to modify the application’s tools, title and color scheme.

  1. The last step of the application publishing process displays a dialog with details
    about the newly published application, and includes a link so you can view the
    item. Click go to the item now to edit the application’s description, thumbnail
    image, tags, and to begin the configuration process. You can always access the
    application via the My Content tab.
  2. Click the Configure App button to display the application configuration page. This page displays a preview of your web map using the Basic Viewer template along with options that allow you to change the appearance of the application and specify the functionality you want to
    include.
    Basic Viewer Config Pane
  3. After making the changes, click Refresh to view the template with your new settings and click Save to apply
    the changes to your application. Note that you can return to the configuration panel at any time and modify the template.

Click here
to view an application created using the Basic Viewer template. We hope you enjoy using the new template and are excited to see applications you build!

Contributed by Kelly Hutchins of the ArcGIS API for JavaScript development team

Posted in Services | Tagged , | 6 Comments

Cross Origin Resource Sharing (CORS) with the ArcGIS API for JavaScript

HTML5 Powered with Performance & Integration Version 2.5 of the ArcGIS API for JavaScript introduced support for cross-origin resource sharing (CORS). CORS allows web applications to bypass a browser’s same origin policy and access resources or services on other servers/domains. CORS is supported in modern, non-IE browsers and is usually classified as a component of HTML5.

When both the web server and browser support CORS, a proxy is not required to do cross-domain requests to get around that same origin policy. CORS both simplifies application development and provides a performance boost. Development is simplified because it is no longer necessary to maintain a proxy page on your server. The performance boost comes from no longer using a proxy page. Instead of a web app sending a request back to its server, waiting for the server to access another resource or service, and then interpreting the result, the app just accesses the resource or service directly. Eliminating the server as a middleman makes apps faster and frees up resources on the app’s server.

To use CORS from an ArcGIS API for JavaScript application, add the root URL for CORS enabled servers to esri.config.defaults.io.corsEnabledServers, which is an array of strings. As stated previously, web servers must be pre-configured to support CORS. This is a straightforward, simple process and enable-cors.org has walkthroughs on how to enable CORS for popular web servers.

While additional server side configuration is required to use CORS with a 9.3 or 10.0 ArcGIS Server instance, 10.1 instances of ArcGIS Server will support CORS out of the box.

Within the ArcGIS API for JavaScript, the main use cases for CORS are sending large geometries to a geometry service and doing various editing operations. Both are done with HTTP POSTs, and would otherwise require a proxy page if the ArcGIS Server services being used were not hosted on the same domain as the requesting application.

To test CORS with the ArcGIS API for JavaScript, check out the sample CORS apps in the ArcGIS API for JavaScript documentation. If you’re using a browser that supports CORS, you will see cross-domain POST requests when monitoring your HTTP traffic using Firebug, Chrome Dev Tools or some other tool. If you hit the apps with Internet Explorer, you’ll see that a proxy is still used. You can also experiment with the ArcGIS Server services running on servicesbeta.esri.com as that server has been configured to support CORS. Enjoy!

Contributed by Derek Swingley of the ArcGIS API for JavaScript development team

Posted in Services | Tagged , | Leave a comment

Version 2.4 of the ArcGIS API for JavaScript released today.

Version 2.4 of the ArcGIS API for JavaScript is now available! Highlights of this release include:

  • Add KML files to your maps. A new KMLLayer class accepts a public URL for a KML file and provides full access to all features.

    WMTS Image

  • Mobile popup widget. A popup specifically designed for use on mobile devices.


    View Larger Map

  • Measurement widget improvements. New methods for fine grained control and projected coordinate systems are now fully supported.
  • Enhanced Web Map Tile Service(WMTS) support. A new WMTSLayer class makes it even easier to use WMTS in your mapping applications.

    WMTS Image

  • Bug fixes. See the What’s new in 2.4 document for more information.

Contributed by Derek Swingley of the ArcGIS API for JavaScript development team

Posted in Services | Tagged | 5 Comments

ArcGIS API for JavaScript Version 2.3 released.

Version 2.3 of the ArcGIS API for JavaScript is now available and includes support for Internet Explorer 9 along with several other new features and enhancements.

  • Internet Explorer 9 support – Version 2.3 includes full support for IE 9 along with improved drawing performance for graphics.

 

 

 

 

  • Snapping – Edge and vertex snapping allows developers to build applications that incorporate snapping when editing, drawing graphics and working with the measurement widget. 

  • Measurement widget – Provides tools for determining the x,y location and measuring area and length.
  • Popup – The Popup class extends the default info window to provide additional functionality like highlighting and zooming to selected features.
  • Android – Several bug fixes and enhancements were added to improve the behavior of applications in the Android browser.

 

Version 2.3 of the ArcGIS API for JavaScript includes Dojo 1.6.1 which contains several bug fixes for Internet Explorer 9. 

View the “What’s New in Version 2.3″ help document for full details. 

Posted in Services | 11 Comments

ArcGIS API for Flex and ArcGIS Viewer for Flex: Version 2.3 released

Versions 2.3 of both the ArcGIS API for Flex and ArcGIS Viewer for Flex are now available. The key enhancements of the 2.3 releases are:

ArcGIS Viewer for Flex 2.3:

  • Supports panning across the date line when working on WGS84 or Web Mercator. This enhancement has been requested by organizations that work with global datasets.
  • Snapping: Simply hold down the Ctrl key and your mouse pointer will snap to features. Snapping enhances the editing experience. Also available in the drawing and measure tools.
  • Out of the box pop-ups: Author pop-up windows in ArcGIS.com and leverage them in the ArcGIS Viewer for Flex. Supports attachments and charting. No identify tool needed. This pop-up functionality work against dynamic and tiled ArcGIS Server map services as well as feature layers. Pop-ups can also be configured with configuration files.
  • Two additional levels of detail for the Bing Maps base map.
  • You can now quick-start your Flex Viewer application using URL parameters, for example center, scale, extent etc. View the URL Parameter samples for more details.
  • Expanded Developer’s Guide with information on viewer architecture, widget framework and localization.
  • Localization enhancements based on feedback from beta and previous versions.

For the full list of viewer enhancements, including changes to individual widgets, view the What’s new in 2.3 help topic.

ArcGIS API for Flex 2.3:

As above for the viewer:

  • Support for latest ArcGIS.com Web Maps, including configured pop-up windows.
  • Several classes to make it easy to programmatically create pop-ups.
  • Snapping
  • More detailed Bing Maps.
  • Panning across the date line.

View the What’s new help topic on the ArcGIS API for Flex resource center for full details on the enhancements including bug fixes and additional classes in the API to make developers more productive.

Posted in Services | Tagged , | Leave a comment

IE 9 support coming in version 2.3 of the ArcGIS API for JavaScript

Version 2.2 of the ArcGIS API for JavaScript was released in early March. . . .right around the time that Microsoft announced that Internet Explorer 9.0 was final and Dojo announced that version 1.6 was available. Version 2.2 does not support either of these, but version 2.3, planned for early May, will support them. We’ve put together an early version of 2.3 to demonstrate how the IE9 enhancements lead to a better mapping experience.

Internet Explorer 9

Internet Explorer 9.0 provides many new features including improved support for CSS3 and HTML5 and dramatic improvements in graphics performance. In earlier versions of Internet Explorer, drawing 1000+ graphics performed poorly compared to browsers like Firefox and Chrome. At IE9, graphics drawing performance is much improved over earlier versions of IE and is comparable to other browsers.

We created a simple test case that draws 1000 graphics on the map to test the performance improvements in Internet Explorer. This table shows our test results, in milliseconds. You can run the test on your machine using the code here. Note that your results may vary depending on the specs of the test machine.

 

Internet Explorer 9 now supports CSS3 behaviors like rounded corners, media queries, transforms and more. The image below shows a sample application in Internet Explorer 8. The css for this application specifies that the corners should be rounded and the header should have a box-shadow applied. However, IE 8 does not support the border-radius or box-shadow properties and they are ignored.

View Application in IE 

 

 

 

 

 

 

 

Here’s the same sample running in IE9, note that the rounded corners and box shadow are now applied.

 View application in Ie

HTML5 support was also enhanced, so now you can take advantage of capabilities like the Canvas Element and Geolocation in IE 9.

  • The HTML5 Canvas Element is a space on the page you can use to render images on the fly. Click here to view a sample that demonstrates using the Canvas Element to draw a raster image.
  • The Geolocation API which can be used to find the user’s current location is now supported across all major browsers. You can test this using the Geolocation sample.

For more details about CSS3 and HTML5 support in IE9 visit caniuse.com.

Dojo 1.6

Enhancements to Dojo 1.6 include Dojox.Mobile enhancements and a growing set of tutorials on various aspects of working with Dojo and Dojox.Mobile. Version 2.3 of the ArcGIS API for JavaScript will use Dojo 1.6.1 which is due out any day now and is scheduled to include several bug fixes for IE9.

Contributed by Kelly Hutchins of the ArcGIS API for JavaScript development team

Posted in Services | Tagged , , | Leave a comment

Version 2.2 of the ArcGIS API for JavaScript released

Version 2.2 of the ArcGIS API for JavaScript is now available. To begin using the new version, update the script and style sheet tags in your applications to point to version 2.2  or version 2.2compact.

Version 2.2 introduces many oft-requested features that will improve the usability of the Web apps you build. These include:

  • Continuous pan across the dateline – If your map uses the WGS 1984 geographic coordinate system or the WGS 1984 Web Mercator projected coordinate system (including the Auxiliary Sphere option), you can pan across the 180 longitude line without encountering the “edge of the earth”. 

    Continuous Pan

  • Support for ArcGIS.com map notes and popups - The next release of the ArcGIS.com Map Viewer, slated for release within a matter of days, will allow you to define popups and save map notes inside the maps you build. When you reference an ArcGIS.com map ID in your JavaScript application, the popups and notes are immediately accessible. This allows you to design your popups interactively in ArcGIS.com instead of through code.

    ArcGIS.com Popup

  • Enhanced Mobile Support – Version 2.2 adds support for the Blackberry Torch (6.0) native browser. You’ll also notice that widgets such as the zoom level slider and time slider are now easier to use on touch screen devices. Explore the samples and code gallery on your iOS, Android or Blackberry Torch smart phone using the mobile site.
  • Customizable Attribute Inspector – The Attribute Inspector now allows you to define which fields in the dataset are editable. You can show the values of the fields while still preventing edits. You can also set custom labels and tooltips on attributes, and even write custom widgets for supplying field values.               

    Attribute Inspector

  • Customizable info window content – You can now use functions to define info window content, allowing you to more easily include a variety of widgets, media, and other content inside your info windows.               

    Info Window

  • Extensible info window using the InfoWindowBase class – A new API architecture for info windows allows you to more easily customize info window look and behavior.                                     

    Info Window

               

Visit What’s New in Version 2.2 for more details and links to specific samples.

Posted in Services | Tagged , | 5 Comments

Building a JavaScript application from an ArcGIS.com template

With all the buzz about the ArcGIS Viewer for Flex, we’re often asked if our team has built a similar viewer application using the ArcGIS API for JavaScript. The answer is no (although you may have spotted an unofficial 1.x-based sample in the user community code gallery). In this post we’ll walk through the process of creating a professional-looking, versatile Web application with the ArcGIS API for JavaScript.

  1. Create a map using the ArcGIS.com viewer and select a Web application template
  2. Download the template and personalize the layout
  3. Add widgets to customize the application

In this post, we’ll walk you through the process.

1. Create a map using the ArcGIS.com viewer and select a Web application template

ArcGIS.com and the ArcGIS.com viewer make it easier than ever to create, edit and share maps. You can build a map using the viewer, then embed the map in an existing site or one of the provided templates. The templates are a new feature that allow you to make a basic Web application out of your map without writing any code. We plan on adding more color schemes and layouts in future templates.

To start this post, we’ll assume that you’ve made a map in ArcGIS.com, you’ve saved the map, and you’ve picked out a template for your application. View this post on the ArcGIS Online Blog if you need steps for accessing the template gallery.

2. Download the template and personalize the layout

Once you’ve found a template that you like, click the download link and follow the instructions to install and configure the template. In this post we are going to customize the Chrome template, so choose that template from the gallery if you’d like to follow along.

Each template comes with a readme file that provides instructions on how to perform common customizations like adding a company logo and modifying the layout text. A critical step explained in the readme file is how to put your map ID in the template, so that your Web application “knows” which map from ArcGIS.com that it needs to display. With the expectation that you’ve wired up the map ID to your template, we’ll move on to personalizing the template by modifying the text color.

Update the text and background colors

The downloaded template includes all the images and style rules used to define the application look and feel. The style rules are included in a CSS file and define how elements in the Web page like links, borders, headers etc. appear.

Open the css/layout.css file in your favorite text editor and look for the title rule. The color property defines the text color for the application’s title using a hex color value. Using a Web site like colorcombos.com find a new color for the title text. Here we’ve picked a dark green color:

#title {    
	color: #595F23;  
        font-size: 30px;
        text-align: left;
       font-weight: bolder;
}

If you like, modify some of the other properties such as font-size and font-weight, then save the file and view index.html in a browser to view the changes.

Another quick change we can make is to modify the background color of the left content panel. In the CSS file, replace the background-color for the leftPane section with a new color. Here we used a pale green:

#leftPane {  
  background-color: #a2b964;
}

W3 schools has a great tutorial on getting started with CSS if you’d like to learn more.

3. Add widgets to customize the application

The JavaScript API at 2.0 includes several new widgets for things that would otherwise require extensive coding and UI design. These include the OverviewMap, Editor, BasemapGallery, Legend and TimeSlider. You can add widgets to the sample layouts to really start adding to the functionality of your template. Take a look at the Seaside with legend template for an example.

Widgets simplify the process of adding advanced functionality to your application. Many of the API samples show how to work with the widgets to create time-aware applications, view and edit attributes, add attachments, create advanced editing applications, and more.

Add the BasemapGallery widget

The BasemapGallery widget displays a collection of basemaps—for example streets, topography, and imagery—that users can select from to provide context to their maps. To incorporate the BasemapGallery widget into the template, we’ll have to modify the javascript and html files.

Open the javascript/layout.js file in your favorite text editor. At the top of the file, import the BasemapGallery by adding the following line of code.

  dojo.require("esri.dijit.BasemapGallery");

Next, paste the following function at the bottom of the layout.js file. This code creates a new BasemapGallery to display a set of basemaps from ArcGIS.com.

function createBasemapGallery() {
  var basemapGallery = new esri.dijit.BasemapGallery({
    showArcGISBasemaps: true,   
     map: map  
}, "basemapGallery");
  basemapGallery.startup(); 
   dojo.connect(basemapGallery, "onError", function(msg) {console.log(msg)});
}

Next, add this line of code createBasemapGallery(); to the application just below the addScalebar() line. Note that you’ll need to add this twice. See the bold sections below.

if (map.loaded) { 
  addScalebar(); 
  createBasemapGallery();
} 
else {
 dojo.connect(map, "onLoad", function() {  
	addScalebar(); 
 	createBasemapGallery();
});

Now you’re ready to position the BasemapGallery widget on the page. You can position the widget so that it sits on top of the map using a dijit TitlePane. The TitlePane is a panel that displays a title and allows you to open or collapse the pane’s content.

Open the index.html file in a text editor and add a reference to the dijit.TitlePane to the dojo.require section.

  dojo.require("dijit.TitlePane");

Next add the bold content below to the ‘Map Section’ to position the TitlePane and BasemapGallery on the map.

<!-- Map Section -->
<div id="map" dojotype="dijit.layout.ContentPane" region="center">
<div style="position:absolute; right:30px; top:10px; z-Index:999;">
  <div dojoType="dijit.TitlePane" title="Switch Basemap" closable="false"  open="false">
  <div dojoType="dijit.layout.ContentPane" style="width:380px; height:280px; overflow:auto;">  
 <div id="basemap
Gallery"></div> </div></div></div> 
 </div>

Open the index.html file in a browser and view your customizations. Here’s an example of how your application might look.

Posted in Services | Tagged , , , | 2 Comments

ArcGIS Viewer for Flex version 2.1 released!

Version 2.1 of the ArcGIS Viewer for Flex is now available.
It has been in beta since June, but this is the first “real” release of the Flex Viewer.

There are a lot of changes since the beta versions, so please download the latest version.
We’ve added two new widgets: the NavigationWidget and the CoordinateWidget.
All other widgets have been improved.
For a complete list of what’s new, improved, changed, fixed, and removed please
read the What’s New.

If you created your own widgets, you need to recompile your widgets.
Most likely you will need to update the code as well. Please read migrating code from beta carefully.

The ArcGIS Viewer for Flex is a newly released ready-to-deploy viewer application.
It is configurable, so you can easily add tools and data content without programming.
You can also extend its functionality with custom widgets available from the Esri community, or create custom widgets yourself with the ArcGIS API for Flex.
The ArcGIS Viewer for Flex is ideal if you want more control over the look and feel of your application.
It is also a good solution if you want to host your own Web mapping applications.

Flex Viewer 

Posted in Services | Tagged , | 5 Comments