Tag: ArcMap

Cleaning up line data with geoprocessing

Editing and data compilation are less commonly thought of as operations that can be automated through geoprocessing. However, ArcGIS 10 introduced the Editing toolbox, which contains a set of geoprocessing tools to perform bulk edits. These tools combined with others in the geoprocessing environment can automate data import and maintenance work. Automated data compilation tools are especially useful for importing data into a geodatabase but can also be employed on a regular schedule to perform routine quality assurance (QA) checks. In this entry, I will discuss the use of geoprocessing to clean CAD line data as part of the import process.

Importing data with geoprocessing
Lines that are created without the use of spatial integrity measures, such as snapping or topology, almost always contain some inconsistencies. These errors are likely in data that originated in formats such as CAD, shapefile, or KML.  Fortunately, many common topological issues can be resolved in an automated manner by using ModelBuilder to link together tools that will import data into a geodatabase and perform standard data cleanup techniques.

I have a CAD file for a new subdivision that needs to be integrated with my existing GIS parcel data. The GIS data must be kept to stringent accuracy standards, so I need to fix any issues where lines do not connect to each other, overlap, or are duplicated. Rather than risk reducing the quality of the main parcels geodatabase, I can create a local temporary geodatabase where I can preprocess the CAD lines before introducing the features into the production geodatabase. Although the CAD file contains buildings, roads, text, registration tic marks, and other features, I plan to use only the parcel lot lines.

I have built a model that imports the CAD lines into a temporary scratch workspace, cleans and processes the lines, and then copies the corrected lines into an output file geodatabase. When importing CAD data into a geodatabase, I can choose from several available tools, including CAD to Geodatabase or Feature Class to Feature Class. The CAD to Geodatabase tool converts all the geometries in a drawing to individual feature classes, such as a line feature class for the parcel lines, annotation feature class for CAD text, and so on. In my case, I am using Feature Class to Feature Class tool because I need only the lot line geometry from the CAD file. This tool makes the model reusable because it can import many different formats and not simply CAD. In addition, the Feature Class to Feature Class tool allows for an SQL expression so I can further refine the import to include only the CAD features that satisfy an attribute query for lot lines (in this case, “Layer” = ‘LOT-L’).

Performing automated quality assurance on lines
Once the CAD parcel lot lines are imported into a geodatabase feature class, I can begin running tools to perform automated QA processes. Many tools are found in the Editing toolbox, although other toolboxes can be purposed for data compilation QA tasks. For example, I can start by using the Integrate tool in the Data Management toolbox to address minor inconsistencies in the line work. Integrate makes features coincident if they fall within the specified x,y tolerance. By using a small tolerance on Integrate (and other similar tools), I can avoid editing the data beyond the level of cleanup I intended. In addition, since I am running the tools on a copy of the data outside my production database, I can run the tools repeatedly to refine tolerance values to fix more issues in an automated manner. The intermediate data created as the model runs is maintained and can be reviewed in the scratch geodatabase.

After the dataset is integrated, I check for duplicated lines with the Delete Identical tool (Data Management toolbox). The dashed lines connecting to this tool represent preconditions, which are used to control the order of operations in a model. For example, the Integrated Lines output is a precondition to the Delete Identical tool. This way, the Delete Identical tool will not execute until the lines have been integrated.

The next part of the model identifies lines that are dangles. With the Feature Vertices to Points tool in the Data Management toolbox, I create a new point feature class containing the line endpoints that are not connected to any other lines. I can then use Select Layer By Location to identify the lines that intersect these dangling endpoints. The resulting selection represents lines with dangles.

Many of these dangle errors can be fixed by running the Editing toolbox’s Trim Line, Extend Line, and Snap tools. Effective use of the Editing toolbox geoprocessing tools can improve productivity because the tools apply edits in bulk, such as to all features or all selected features. In most cases, the similar editing function applies to only one feature at a time. Because I exposed the tolerances as variables and model parameters, I can easily run the model with different values because the tolerance settings appear as input boxes on the tool’s dialog box. For example, I am willing to extend or trim the lines from this CAD dataset initially up to a maximum length of five feet. After that procedure, I want to inspect the lines visually to see how many issues remain to ensure that I will not be making incorrect edits if I increase the tolerance value. I can change the tolerance as needed depending on the accuracy of the lines I am importing.

In addition, since my organization’s spatial integrity rules indicate the parcel lines should be split and not intersect themselves, I can use a sequence of spatial and attribute queries to find the locations where lines have intersecting endpoints. Lines are often split so that each length can be attributed separately.

Once these processes have run, the lines are output into a feature dataset in a geodatabase and are much cleaner topologically. After the model completes, I can run the Feature Vertices to Points tool again on the cleaned output to see the remaining dangles and compare the current number of endpoints that are dangles (the yellow circles in the graphic) to the number in the original CAD lines (the red circles). While there may be a few remaining issues, there are less than before running the model. At this point, I can build a geodatabase topology to check for and repair any other errors. When I am satisfied that the lines meet the standards for our spatial data, I can import it into the production database.

For more information:
The sample tools and data can be downloaded from the Editing Labs group on ArcGIS.com. An ArcInfo license in required to run the tools.

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

Introducing Custom Steps in ArcGIS Workflow Manager

The notion of “custom steps” in ArcGIS Workflow Manager can be confusing. Many people hear “custom” and think immediately of software development. With Workflow Manager, the reality is that a workflow designer will create and configure many different step types by using the Workflow Manager Administrator application. Even steps available out-of-the box – including special purpose steps called “Custom Step Objects” – will likely be customized in Workflow Manager Administrator to your organizations specific environment.

This blog post will discuss step customization (somewhat), Custom Step Objects (mostly), and how they can help in your workflows. If you remember nothing else, just remember that using custom steps in Workflow Manager doesn’t necessarily equate to writing custom code!

Continue reading

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

Default Geoprocessing Symbology

While preparing for a demonstration showcasing some new Geoprocessing tools, I found a way to have the outputs of a tool to use a different default symbol than what ArcMap assigns the result when added to the map.

To do this, in ArcMap, run the tool to get the result you’re looking for, then open the Symbol Selector (single click on the symbol in the TOC). Next, change the symbology for the output to whichever icon/color you’d like to use, here I created a photo icon.  In the Symbol Selector window, click on Save As…

Next, name the newly created symbol with the same name as the output generated from the tool (ex, Photos).

Now, when you run a tool that outputs to that geometry type and name, it will default the symbology to what you created.  The key is it must be the same name every time.

Posted in Electric & Gas, Uncategorized | Tagged , , , , , , | Leave a comment

Managing layer visibility and selections

Managing layer visibility and selections with the table of contents’ List By Visibility mode

The table of contents in ArcGIS 10 has several ways of listing the layers in the map: by drawing order, source location of the data, whether layers are visible, and whether layers are selectable. A particular list type may be more useful than others depending on the current mapping task. For example, List By Drawing Order is best at setting which layers draw on top of others and List By Source works well to help repair broken data links for layers from different workspaces. In an earlier post, I focused on the table of contents’ List By Selectable mode when I wrote about refining the selected features while editing. In this post, I am going to show how I can use List By Visibility to manage layer visibility and selections.

Continue reading

Posted in Editing | Tagged , , , , , , | Comments Off

New ArcGIS Online Basemaps

A couple of nice additions to the ArcGIS for Desktop 10  basemap gallery were made last week:

1. We added an entry for the new Light Gray Canvas basemap which provides a neutral basemap that makes your thematic data really stand out. There are some useful blog posts about this new basemap on the Mapping Center blog

2. We renamed the  ‘Physical’ basemap to ‘Physical and Ocean’ and added the Ocean basemap
into this as a layer. When you add the Physical and Ocean basemap into
your map, you can turn the Ocean basemap on in the entry for this
basemap in the Table Of Contents if you want to see rich detail for the
world’s oceans.

To add  these basemaps into ArcGIS for Desktop 10, choose File > Add
Data > Add Basemap in ArcMap or ArcGlobe. To add them into 9.3 or
9.3.1, choose File > Add Data From ArcGIS Online.
Alternatively, here are the layer packages for the Light Gray Canvas basemap and the Physical and Ocean basemap that you can add directly into your map or globe.

To add these basemaps into your map or globe via the Catalog, make a connection to this ArcGIS server: http://services.arcgisonline.com/arcgis/services
and then add the World_Light_Gray_Base and World_Light_Gray_Reference
services from the Canvas folder, or the Ocean_Basemap service.

Posted in ArcGIS Online | Tagged , , , , , , , , , , , , | Leave a comment

Fresh additions to the ArcGIS.com Editing Labs group

After hearing your feedback at the 2011 Esri International
User Conference, we on the Editing development team have been busy resolving
some of the workflow issues reported with ArcGIS 10. At your request, we have
developed two new tools for creating smooth curves and another one to cut
circular holes in polygons. You can download these tools from our ArcGIS.com
group called Editing
, which we use as a repository for prototypes and samples to extend the
ArcGIS 10 editing environment (make sure to filter by Show: All Content at the
top of the page). This blog entry highlights the new add-ins available from
Editing Labs.

Curved Construction

ArcSketch was a free add-on for ArcGIS 9 to support “back of
the napkin,” GeoDesign-style workflows, such as redlining features and
sketching land-use plans. Features could be created quickly by picking a symbol
on a palette, choosing a tool, and clicking the map to draw it. ArcSketch was deprecated
at ArcGIS 10 when this symbol-based feature creation workflow was incorporated
into the core editing experience through feature templates and the Create
Features window.

A user we spoke to at the UC wants to map zones for receiving
aircraft navigation radio signals by connecting known points with smooth
curves. In ArcGIS 9, he used the Curved Polygon tool in ArcSketch to draw these
features, but we were left scratching our heads about how to perform this task as
easily using the construction tools available in ArcGIS 10. So, we got to work
building a new sample for Editing Labs called the Curved Construction Tool.

Once I download and install the Curved
Construction Tool
, the Curved tool appears in the tools list on the Create
Features window when I activate a line or a polygon feature template. The
Curved tool allows me to create lines and polygons with curves that are splined
through fixed points. In my case, I am going to use the Curved tool to connect
points representing water sampling locations at springs (shown by the blue
circles on the map) to draw a polygon of a hydrologic study area.

I start the curved feature with a single click and add
subsequent points with clicks. I can utilize the snapping environment to snap
to the existing sampling point features when setting the locations through
which the curve passes. After I have digitized all the curves, I finish the
sketch. When creating polygon features, they are closed automatically with a
curved segment.

Each location I click becomes a vertex shared by adjacent Bézier
curves. The curve is defined by the locations of those vertices and additional
control points at the end of blue Bézier handles that radiate from each vertex.
If I want to reshape or move the curves manually, I can double-click the
polygon with the Edit tool.

Auto Complete
Freehand Tool

Several users told us they want to use freehand shapes to
create adjoining polygons. For example, members of a wildland search and rescue
group need to draw search areas and add adjacent polygons as the search
expands. The existing Auto Complete Polygon tool appends new polygons next to
existing ones, but the editor has to click to place each vertex. The Freehand
tool, on the other hand, creates smooth curves that follow movements of the
mouse without needing to click to create vertices, but the tool does not append
to existing polygons. Therefore, we developed the new Auto Complete Freehand
tool to combine the functionality of these tools.

As with the other sample, once I download and install the Auto
Complete Freehand Tool
, the new tool appears in the Create Features window
when I activate a polygon feature template. I am going to use the tool to
digitize adjoining polygons representing vegetation types by tracing over a
basemap image. Starting from the boundary of an existing polygon in the same
vegetation layer, I click once to start the freehand line. I do not need to
hold down the mouse button as I am creating the new polygon’s shape. The new
polygon’s boundary follows the movements of my pointer, although I can hold
down the spacebar if I need to snap to an existing feature.

The new polygon’s boundary must cross or touch the existing
polygon edge at least two times.  I just
need to click once to finish drawing the freehand shape and create the feature.
The freehand line is automatically smoothed into Bézier curves, although the
existing segments that are shared with the new feature are not smoothed. The
vegetation polygons now share a border, but the Auto Complete Freehand tool
allows me to avoid digitizing that edge twice or creating overlaps or gaps
between polygons.

Cut Polygons With
Circle Tool

We heard from a couple of users who want to cut a polygon
with the shape of a circle. For example, one user works with farmlands that are
irrigated by center-pivot systems and needs to cut out the circular-shaped
fields from the surrounding acreage. Another user edits circular oil tanks and
wells that should be cut from the well pad features. These users had found a
simple way of doing their tasks in ArcGIS 9, but ArcGIS 10 requires two steps: drawing
a circle feature and using the Editor menu > Clip command to cut out the
circle. In addition, Clip is inadvertently causing them to edit more features
than intended, since it cuts all visible and selectable polygons underneath the
selected feature. After hearing these scenarios, we created the Cut Polygons
With Circle Tool add-in for Editing Labs so these tasks could be performed
easier in ArcGIS 10.

Using the example of center-pivot irrigation fields, I am
going to cut out actively growing crops from the surrounding perimeters.
Center-pivot is a form of crop irrigation in which equipment rotates around a
hub, creating a circular pattern of irrigated cropland that is often visible in
aerial photography. Once I install the Cut
Polygons With Circle Tool
add-in, I need to open the Customize dialog box
in ArcMap and drag the command onto a toolbar, such as the Editor toolbar.

Next, I select the agricultural field and click the Cut
Polygons With Circle tool on the toolbar to which I added it. Using the imagery
as a guide, I click to place the center of the circle at the field’s central
pivot point. I could have also used the A key to enter x,y coordinates for the
center point. A line representing the radius appears inside the circle as I
draw it. I can drag the circle manually, or since I know that the radius of the
field is 200 meters, I can press R and type the value.

After entering the radius, I press ENTER to finish the
circle and cut the polygon. This leaves me with two features: the outer perimeter
that now is a multipart feature with a hole in it and the inner circle. Since
the circle represents the actively irrigated crop area, I update the feature’s attributes
now that it has a land-use type different from the surrounding field.

Giving us feedback
Please let us know what you think of these tools by adding a
comment to their download pages. We have been uploading samples to Editing Labs
regularly, so check back for new additions. When accessing the Editing Labs
group, make sure to filter by Show: All Content at the top of the page. You can
submit general suggestions on how we can improve the editing experience by adding
to the ArcGIS Ideas site or contacting Esri Support. In addition, we encourage
you to join the ArcGIS 10.1 beta
to preview and provide feedback on the next release of ArcGIS.

Special thanks to the UC attendees who spent time helping us
understand their needs.

Post from Rhonda G. (Editing Team)

Posted in Editing | Tagged , , , , , , | 1 Comment

New Resources Available for Getting started with Python Map Automation

ArcGIS 10 provides a new Python
mapping module (arcpy.mapping) that allows you to interact with the contents of
map documents and layer files without necessarily needing to interactively open an
ArcMap session.  The methods, properties and functions available in this
new map scripting API enable you, for example, to automate changing data
sources, modify layer properties, export and print maps, as well as automate the
creation of
thematic maps and map series.  Because the new mapping module is part of
the ArcPy geoprocessing framework, scripts can be used within ArcGIS Desktop
but can also be published to ArcGIS Server as geoprocessing services making
it much easier to make mapping and printing capabilities available on the

The following links are resources
that will help you learn more about arcpy.mapping, get access to popular
sample scripts available for download, and
links to new training resources:

Help Resources

  • A new Introduction to
    help topic is a great starting point. It includes
    links to a new arcpy.mapping tutorial and general guidelines for working with
    arcpy.mapping. ArcGIS Desktop help has a complete section
    dedicated to the ArcPy mapping module. Embedded within the help topics
    are over 100 different, practical help samples that can be copied/pasted into your applications. Be
    sure to review the “Best ways to get started” section.

Sample Applications

  • Approximately 20
    script tools
    that perform routine map and layer management tasks, printing and
    exporting, as well as basic cartographic operations.
    This is an excellent download because it
    includes many practical code samples that perform a variety of tasks and they
    are easy enough to modify for your own purposes.
  • A script
    that combines Data Driven Pages, arcpy.mapping, and the ReportLab site package to generate a reference map book that includes street index
    pages. It demonstrates how arcpy.mapping can be used to extend Data
    Driven Pages capabilities.
  • A script
    that incorporates Data Driven Pages and arcpy.mapping to build a map series
    that includes dynamic graphic tables. There is a very complete README.doc file
    included with the download that also addresses other useful tips and tricks
    that go along with the application.

 Web Courses

  • Basics of Python (for ArcGIS 10).
    This course teaches fundamental concepts you need to know to create
    Python scripts in ArcGIS. You will learn guidelines for proper Python syntax,
    techniques to troubleshoot common errors, and how to use loops to test for
    conditions and execute different code based on the result.
  • Python Scripting for Map Automation in
    ArcGIS 10
    This course teaches how to automate map production and
    related data management tasks that would be time-consuming and tedious to
    perform manually. You will learn how to work with the mapping module of the
    ArcPy site package to quickly and easily update map layers and map document
    properties, modify map content, and produce individual maps and map books.

 Special thanks to David from the Mapping Team for sharing these links.

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

Useful Tip for Flex Viewer Basemaps

I thought I would share a trick that we found recently with you.  Customers have had the desire to zoom in past the current lowest scale offered by the basemaps (1:600 for Bing, for example) in the Flex Viewer (the lower scales were introduced with the 2.3.1 viewer). 

The first step was adding the basemap to ArcMap and publishing a service (note this goes away at 10.1).  This service was cached using the Web Mercator projection ArcGIS Online cache config and then the two lower scales were added.  Tiles were only generated for the 1:400 and 1:200 scales.  Note, these tiles look pixilated but that is preferred versus the text that there are no tiles found or not being able to zoom past 1:600.   

Next you need to tell the Flex Viewer you have a custom range of scales, by default the scales are determined by your basemap (first one), for example the Bing basemap only goes to 1:600 so that’s as far in as you can zoom.  To override that and add 2 additional scales (1:400 and 1:200) you need to add some xml right after the closing </basemaps> in the main config.xml for example:

    <lods><!– show these levels –>

        <lod resolution=”78271.5169639999″ scale=”295828763.795777″/>

        <lod resolution=”9783.93962049996″ scale=”36978595.474472″/>

        <lod resolution=”1222.99245256249″ scale=”4622324.434309″/>

        <lod resolution=”152.874056570411″ scale=”577790.554289″/>


Wondering where you are going to get these values from?  There is a cache definition file for the service that we can copy and paste from, note we need to have every extent listed here, if it’s not listed it will not be available as a scale level to zoom to.  Go to your server and navigate to the ArcGIS server cache directory (C:arcgisserverarcgiscache), in here find the folder containing your cache with additional scales and drill down until you see config.xml.  Open this up in notepad and get ready to copy and paste.  You are interested in everything below <LODInfo>, make sure you start at levelID 0 and grab each and every resolution and scale.

Once that is done you need to add your custom cached map service as an operational layer set to visible=”true”.  This means it will always be on but we’ll only see it when we get down to 1:400 and 1:200, since it will be on top of the actual map service we won’t see those tiles with the messages that there is no data for this extent.

Next, since you don’t want people to be able to turn the cached operational layer off we can exclude it from the layer list widget (the More… dropdown).  Go to your Flex Viewer directory and then widgetslayerlist and open layerlistwidget.xml.  In here just specify the layer name of your cached service (the operational layer), this will prohibit people from being able to uncheck it.

In this example we’re using the Bing basemaps, if you were using others you would need to add additional scales to cover the gap (for example the Esri Topographic map service only goes to 1:1200 in some areas) and would have a situation where it goes from topo or imagery to a streets basemap.

There you go!

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

Incorporating snapping into custom tools

If you are writing a custom tool in ArcMap to select features or create geometry a certain way, then you’ll often need to make it snap to existing features on the map. In the past, snapping was restricted to editing and was somewhat cumbersome for developers to implement. However, ArcGIS 10 provides the ArcGIS Snapping Environment, which offers users a simplified experience in ArcGIS Desktop or ArcGIS Engine and gives developers a straightforward application programming interface (API) to enable snapping in custom tools. This blog entry introduces you to the snapping API and provides sample code that demonstrates how you can incorporate snapping into your own tools.

To implement snapping in a tool, there are two options available depending upon if the tool will be used while editing. If your tool will be used both inside and outside an edit session, you can implement snapping directly by going through the snapping extension. If your tool will be used exclusively within an edit session, you can access snapping indirectly through the Editor object, which takes care of most of the initialization work for you.

Implementing snapping via the extension
First, I am going to show you how to access the snapping environment directly using its extension. This is applicable for a tool that can be used both inside and outside of an edit session. To demonstrate this, I develop a simple tool that reports the x,y location of a mouse click at its snapped location.

I start by creating a tool add-in by following the directions from the SDK help topic, Building add-ins for ArcGIS Desktop. Then, with the help of Working with the ArcGIS snapping environment, I add the code required to enable snapping in the tool. After adding a reference to the ESRI Controls assembly, I can access and initialize the snapping environment in my tool’s Click event. For add-in tools, this event is the OnActivate method.

Next, I can use the cursor location returned from the tools MouseMove event and determine if it actually snaps to anything. If it does, then I update a variable with the snapped position.

The complete code sample is shown below.

using ESRI.ArcGIS.Controls;

using ESRI.ArcGIS.Geometry;



: ESRI.ArcGIS.Desktop.AddIns.Tool


ISnappingEnvironment m_SnappingEnv;

IPointSnapper m_Snapper;

ISnappingFeedback m_SnappingFeedback;

IPoint m_Position;

public ShowMapCoordinates()



Protected override
void OnActivate()


//Get the snap environment and initialize the feedback

UID snapUID = new

snapUID.Value =

m_SnappingEnv = ArcMap.Application.

FindExtensionByCLSID(snapUID) as

m_Snapper =

m_SnappingFeedback = new

m_SnappingEnv, true);


protected override
void OnMouseMove(MouseEventArgs


//Get the current position in map units

//This is the cursor location before snapping

= ArcMap.Document.ActiveView.

ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);

ISnappingResult snapResult =

//Try to snap the current position

= m_Snapper.Snap(m_Position);

m_SnappingFeedback.Update(snapResult, 0);

if (snapResult != null)

//Snapping occurred

//Set the current position to the snapped location

m_Position = snapResult.Location;


protected override
void OnMouseDown(MouseEventArgs


System.Windows.Forms.MessageBox.Show(“Map units:rnX: “

+ m_Position.X.ToString() + “rnY: “ +


protected override
void OnRefresh(int


if (m_SnappingFeedback !=





In my code, the variable m_Position holds the snapped position of the cursor. If my tool were creating geometry or updating screen feedback (such as with INewLineFeedback), then I would use the m_Position variable rather than the mouse position (MouseEventArgs) as the update point.

Implementing snapping in an edit session
As I mentioned before, if you are developing a tool that will be used exclusively in an edit session, implement snapping with the help of the Editor object. The main advantage of doing this is that the Editor will work with either the ArcGIS Snapping Environment or editing classic snapping, but only in an edit session, of course. Classic snapping refers to the snapping functionality that was available during an edit session in ArcGIS 9 and allows you to set up snapping in a more complex manner on a layer-by-layer basis. The ArcGIS Engine edit sketch and any custom tools that derive it are limited to the classic snapping environment.

Generally speaking, there two types of Editor tools you can build: those that use the edit sketch and those that don’t. You would typically use the edit sketch in a tool if you wanted to use the sketch to help you create some geometry or feedback on the screen. You can then take that geometry and use it as the basis to create a feature with it or use it for selections. If you are creating an ArcMap tool that uses the edit sketch, you don’t have to worry about snapping at all since the Editor handles it entirely for you. The edit sketch also comes with its own context menu (the one used by the Polygon or Line construction tools) and shape constructors, so it’s convenient for developers. In ArcGIS 10, you can only build a tool that uses the edit sketch through COM, which creates a .dll.

If you are not using the edit sketch in your tool, which is most likely because it doesn’t provide the geometry you need, then there is a bit more work involved because you have to create your own geometry using mouse clicks and implement snapping yourself. This type of tool can be made into an add-in or COM .dll.

For the sample code, I’ll use the same example of an add-in tool that reports the x,y position of the snapped location. In this case, I only have to reference the Editor and not the Controls assembly to enable snapping.






: ESRI.ArcGIS.Desktop.AddIns.Tool


IEditor m_Editor =

IPoint m_Position =

public ShowMapCoordinatesES()


m_Editor =


protected override
bool OnDeactivate()


if (m_Position != null)

m_Editor.InvertAgent(m_Position, 0);

= null;

return true;


protected override
void OnMouseMove(MouseEventArgs


if (m_Position != null)

m_Editor.InvertAgent(m_Position, 0);

= m_Editor.Display.DisplayTransformation.ToMapPoint(arg.X, arg.Y);

//Get the snap environment from the editor

ISnapEnvironment se = m_Editor
as ISnapEnvironment;

Boolean snapped = se.SnapPoint(m_Position);

m_Editor.InvertAgent(m_Position, 0);


protected override
void OnMouseDown(MouseEventArgs


System.Windows.Forms.MessageBox.Show(“Map units:rnX: “

+ m_Position.X.ToString() + “rnY: “ +


protected override
void OnRefresh(int


if (m_Position != null)

m_Editor.InvertAgent(m_Position, hDC);


protected override
void OnUpdate()


Enabled =
(m_Editor.EditState == esriEditState.esriStateEditing);




The code is very similar to the extension example, where the variable m_Position holds the snapped position and would be used to create geometry or update feedback. In this case, I have to be careful with refreshing the feedback. The code calls InvertAgent, which essentially paints the screen with the feedback of a blue dot. To erase the feedback, I need to call InvertAgent again. If I get out of sync, I can be left with feedback graphics on the screen that will not go away until I refresh the screen. Normally, though, if you are working with ArcGIS Snapping, the environment takes care of this for you.

For more information
To learn more about developing with the ArcGIS Snapping environment, see Snapping in ArcGIS in the ArcGIS Developer Help.

To view some example editing tools that incorporate snapping, see the Editing Labs group on ArcGIS.com (make sure to filter by Show: All Content at the top of the page).

Post content from Sean (Editing Team)

Posted in Developer, Editing | Tagged , , , , , , , , , , | Comments Off

Creating Map Books using Data Driven Pages

A few weeks ago, thousands watched a live training seminar on the new Data Driven Pages in ArcGIS 10.  If you missed this excellent live seminar you can watch it on demand from Esri Training.

Using the ArcGIS 10 Data Driven Pages feature, you can quickly and easily create a professional-quality map book from a single map document. This seminar teaches the workflow for using Data Driven Pages. The presenter also covers how to create an index layer from a feature layer and add dynamic text and locator maps to your map pages.

Who Should Attend
GIS professionals and cartographers working in utilities, transportation, public safety, and government mapping agencies and others who need to produce map books.

Key Points
The presenter discusses

  • Data Driven Pages, map books, index feature extents, and geoprocessing tools.
  • The process for building map books.
  • Updating, printing, and exporting map books.


Posted in Developer, Mapping, Python | Tagged , , , , , , , , , , , | 6 Comments