Monthly Archives: January 2009

Querying points and lines on click with the ArcGIS JavaScript API

Many of the existing ArcGIS JavaScript API samples for the Query task show how to query polygon features. This post explains one way to query points and lines with a mouse click on the map.

Querying a point or a line is a little more difficult than querying a polygon because the mouse click is required to fall directly on the line or point in order for a result to be returned. To makes things easier for your users, you can build a “tolerance” envelope around the clicked point.

       var centerPoint = new esri.geometry.Point
        var mapWidth = map.extent.getWidth();

        //Divide width in map units by width in pixels
        var pixelWidth = mapWidth/map.width;

        //Calculate a 10 pixel envelope width (5 pixel tolerance on each side)
        var tolerance = 10 * pixelWidth;

        //Build tolerance envelope and set it as the query geometry
        var queryExtent = new esri.geometry.Extent
        query.geometry = queryExtent.centerAt(centerPoint);

In the above code, you figure out the width of one pixel in map units given the current scale. You then multiply this by the total tolerance width in pixels. So if you want a tolerance of 5 pixels on each side, you multiply by 10. This gives you the width of your tolerance envelope in map units.

You then use one of the esri.geometry.Extent constructors to make the square tolerance envelope. Any feature that intersects the envelope will be returned as a query result.

Building a rectangular tolerance around the clicked point

It’s worth noting that the Identify task has a built-in tolerance that you can easily modify using IdentifyParameters. However, the Identify task does not allow you the flexibility to determine which fields are returned. The Query task lets you narrow the fields.

Contributed by Sterling Quinn and Jeremy Bartley of the ArcGIS Server development team

Posted in Services | Tagged , , | 4 Comments

Dev Summit 2009 Technical Session Agenda – Now available!

As you know, the ESRI Developer Summit is just around the corner.  We worked hard to get all of the sessions and descriptions published early, so be sure to check out the online schedule to help plan your conference, and to get a sneak preview of what’s coming. 

There are three main types of sessions:

Also, if you are interested in delivering a User Presentation yourself, be sure to sign up today.

Visit the ESRI Developer Summit for more event information.


Posted in Developer | Tagged , | Leave a comment

Exploring Antarctica

Here’s an interesting post that just appeared on the GIS Education Community Blog from George Dailey, ESRI Education Manager. It covers a trip by a colleague (Robyn Johnson) to Antarctica, and uses Explorer to tell the story about the adventure. It uses several tasks and incorporates the ArcGIS Online basemaps with data from NOAA, and also incorporates Robyn’s blog entries and YouTube vids using notes and their popups.

To learn more about notes and what you can do with them, check out these previous posts:

Tutorial: All About Notes

New Streaming Video: Creating and Using Notes

Tutorial: Putting YouTube in Your Notes

Adding Photos and More to Note Popups

Posted in Uncategorized | Tagged | Leave a comment

New Geodatabase replication patch and article

Here’s a heads up on a couple items of note regarding replication:

There is a new 9.3 SP1 geodatabase replication patch. This patch addresses cases where replica system versions are not being removed when they should be during a connected synchronization. We recommend that all who use geodatabase replication with ArcGIS 9.3 install this Patch.

There is also a new article that describes timeouts and data limitations when replicating with geodata services over the internet. Anyone replicating with geodata services over the internet should review this document.

Posted in Geodata | Tagged , | Leave a comment

A cockpit view using display overlay

Today we had a question from someone wanting to incorporate a visual portrayal of plane’s cockpit dashboard with ArcGIS Explorer. The requirements were pretty simple, and didn’t require actual “flight simulator” controls, and so we came up with a simple solution to meet the needs of this particular scenario using a display overlay, one of the map properties.

We’ve covered the use of display overlays in the past, most notably with a post titled Display overlay, legends, and streamlining the user experience, and have featured some of its uses. Display overlays are PNG files that can be placed just about anywhere on the display, and are saved with the map. Subsequently if we have our own home server or resource center, the maps we use from those locations can also be stamped with any PNG we want.

In the example below, we’ve used a display overlay to stamp “confidential” onto our map:

And here’s another example where we used the display overlay to add a floating legend:

For the airplane, we took a PNG file showing a portion of a cockpit and formatted it to fit our desired display size. We opened up the map properties (File > Map Properties) and chose Display Overlay. We checked on Enable Display Overlay, browsed for our file, checked off the image cache (not needed), and set the Screen Location for the bottom row, middle position.


To provide a full screen effect we hid the console by unchecking it from the View menu.

Here’s our “cockpitized” view. Everything but what is seen through the windshield is the display overlay and remains static, while you can use the mouse and keyboard to navigate and view through the cockpit window.

Posted in Uncategorized | Tagged | Leave a comment

Three ways to view a good shaker

Well, we were sitting around this evening wondering what our first post for 2009 would be, when the answer came in the form of a little roller coaster ride, thanks to an earthquake whose epicenter was just 6 miles from ESRI. We’ve covered earthquakes here on the blog plenty of times before, so we thought we’d do something a little different and take a look at the USGS earthquake data in 3 different ways as it’s published at the USGS site.

First we viewed the GeoRSS feed. The connection was already stored in our list of connections since we’ve used that GeoRSS feed before. We just opened up the connection by choosing File > Open, and then choosing Servers in the Open Content dialog. Once we did, we could just scroll down the list of our remembered connections to find the quake feed to view it.

The feed displays all the quakes greater than magnitude 2.5 over the past day. We also used Find Address to locate ESRI, and used Measure to determine the distance from ESRI to the epicenter of the quake, which was just under 7 miles.

Next we opened the KML published on the USGS site showing all quakes greater than 1.0 in magnitude over the past 7 days. Note the display overlay in the upper left that came along with the KML, and the small aftershock (1.7 magnitude) located within a half mile of the initial temblor.

Finally we opened the USGS quake data delivered as a comma-delimited text file. We clicked on its link at the USGS site to view it in a browser, and this is what we saw:

We saved the file out as a text file, and took a look at it using Notepad. The first line in the file had field names, which was just perfect, but we had to do some minor edits to pull in the information the way we wanted. We removed quotation marks (using a global search and replace with a space) from around a combined day/date/time field, and added the extra field names to match the new formatting on the first line. We saved the file, then chose Tools > Import File to open the file import wizard.

In the first dialog we just accepted the defaults. Note the data preview panel at the bottom of this dialog which shows us how the text file is being parsed. This was especially useful since we could verify that we correctly made the edits to the file mentioned above.

After clicking Next, in the following dialog we again accepted all the defaults (the latitude and longitude fields were already found, since they had been named “lat” and “lon” in the text file) and chose “Magnitude” as the title field (so we could view it as we hovered over the location with our mouse) and “Region” as the description field.

Then we chose a symbol, and here’s our map with the quake information imported from the text file.

This file contains all the magnitude 1.0 or greater quakes for the last day, and you can see there’s been lots of activity in southern California during that time period.

Posted in Uncategorized | Tagged , , | Leave a comment

Layer symbology for NHD data

By Charlie Frye, Esri Chief Cartographer

NHD - Thumbnail

Most maps should have some depiction of hydrography.  The problem is, if you’re not familiar with the data or the typical symbology conventions, it’s hard to find the time to make the required effort. In the U.S., hydrography data is available from the USGS in the form of the National Hydrography Dataset (NHD). Once you download the NHD data you need (TIP:  you need to allow popups on this site), the next task is symbolizing it. To help with that here are a few layer files that you can load into ArcMap, then use the Layer Properities’ Source tab to change the data source to your data.

Continue reading

Posted in Mapping | Tagged , | 7 Comments