Do the new reconcile options work against older releases of ArcSDE geodatabases?

This was a question I got from a friend in tech support the other day and it’s a pretty good one. Short answer is yes, here’s why:

At 9.2 we added a number of different reconcile options offering users more flexibility when reconciling versions in an ArcSDE geodatabase. For those reading this that are wondering what a reconcile is or how versioning works I would suggest reading the Understanding Version section in the ArcGIS desktop web help. As the graphic below shows, at ArcGIS 9.2 we augmented the reconcile dialog to give users a choice of how conflicts are defined and resolved.

At ArcGIS 9.2 you can now determine how a conflict is defined either by object or by attribute. Also provided at 9.2 is the ability to specify how conflicts encountered during a reconcile are resolved. Conflicts can be resolved in one of two ways either in favor of the version you are reconciling with (Target Version) or in favor of the version that is being reconciled (Edit Version).

The important part here is all the logic for these options resides in the connecting application and not in the ArcSDE geodatabase. What this means for you is that if these options are available (i.e. you are connecting through ArcGIS 9.2 or a more recent release) you can use these options during a reconcile even if you are connected to a ArcSDE geodatabase that has not been upgraded to a recent release.

As a side note, the same also applies for the merge geometries functionality we added at 9.3.

Posted in Geodata | Tagged , | Leave a comment

Working with custom renderers in the .NET Web ADF

Custom 2.5D renderer for Washington DCThe Web ADF allows you to go beyond the default symbols for graphics layers by creating custom renderers. This post will show how to create custom renderers and apply them to FeatureGraphicsLayers using the IRenderer interface. The IRenderer interface allows you to take full control of how a specific feature is rendered on the map by using .NET’s System.Drawing classes.

The IRenderer interface consists of five methods, but if you can do without support for the Table of Contents (TOC) control, only one of them is really needed, and you can use some very simple implementations of the remaining four methods.

The five methods are:

  • GenerateSwatches – Generates swatches for this renderer for display in a table of contents
  • GetAllSymbols – Returns all FeatureSymbols used by this object, if any
  • GetMaxSwatchDimensions – Gets the maximum dimensions of the swatches generated by this renderer
  • Clone – Returns a clone of this renderer
  • Render – Draws the specified geometry to the specified graphics

For the simplest renderer, the following is sufficient for the first four methods:

public SwatchCollection GenerateSwatches(SwatchInfo swatchInfo, string fileName, string minScale, string maxScale)
{
return new SwatchCollection();
}
public void GetAllSymbols(List< FeatureSymbol> symbols) { }
public void GetMaxSwatchDimensions(ref int width, ref int height) { }
public object Clone() { return this.MemberwiseClone(); }

This implementation will not support swatches, but we will later get back to how to also support this.

The main method we need to look at is “Render”. As input you get three parameters: The row with attributes you are rendering, a reference to the graphics instance that you should render to, and the name of the column in the datarow that contains the geometry data. The geometry data that is parsed in here is not in map units, but has already been converted to screen coordinates, so you don’t have to worry about translating your feature to the screen.

So the very first thing we do in our renderer is to fetch the geometry that we want to render. In most cases the first few lines of a renderer will look something like this:

public override void Render(DataRow row, Graphics graphics, DataColumn geometryColumn)
{
if (row == null || graphics == null || geometryColumn == null)
return;
Geometry geometry = row[geometryColumn] as Geometry;

In this first part, we will only support rendering points, so the next stop would be to limit by geometry type:

if (geometry == null || !geometry is ESRI.ArcGIS.ADF.Web.Geometry.Point)
return;

Next we can use System.Drawing classes to draw an image at the point, which completes our very simple point renderer:

ESRI.ArcGIS.ADF.Web.Geometry.Point p = geometry as ESRI.ArcGIS.ADF.Web.Geometry.Point;
using(System.Drawing.Image img = System.Drawing.Image.FromFile(@"C:inetpubwwwrootmyAppimagesicon.png"))
{
graphics.DrawImageUnscaled(img,Convert.ToInt32(p.X),Convert.ToInt32(p.Y));
img.Dispose();
}

Here’s the complete renderer implementation:

using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.ADF.Web.Geometry;
using ESRI.ArcGIS.ADF.Web.Display.Swatch;
using ESRI.ArcGIS.ADF.Web.Display.Symbol;

namespace WebADF.Datasources.Renderers
{
public class SimplePointRenderer : ESRI.ArcGIS.ADF.Web.Display.Renderer.IRenderer
{
public SwatchCollection GenerateSwatches(SwatchInfo swatchInfo, string fileName,
string minScale, string maxScale)
{
return new SwatchCollection();
}
public void GetAllSymbols(List<FeatureSymbol> symbols) { }

public void GetMaxSwatchDimensions(ref int width, ref int height) { }

public void Render(System.Data.DataRow row, System.Drawing.Graphics graphics,
System.Data.DataColumn geometryColumn)
{
if (row == null || graphics == null || geometryColumn == null)
return;
Geometry geometry = row[geometryColumn] as Geometry;
if (geometry == null || !(geometry is ESRI.ArcGIS.ADF.Web.Geometry.Point))
return;

ESRI.ArcGIS.ADF.Web.Geometry.Point p = geometry as ESRI.ArcGIS.ADF.Web.Geometry.Point;
using (System.Drawing.Image img = System.Drawing.Image.FromFile(ImageIcon))
{
graphics.DrawImageUnscaled(img, Convert.ToInt32(p.X – img.Width/2),
Convert.ToInt32(p.Y) - img.Height/2);
img.Dispose();
}
}

public object Clone() { return this.MemberwiseClone(); }

private string imageIcon = @"C:inetpubwwwrootmyAppimagesicon.png";

public string ImageIcon
{
get { return imageIcon; }
set { imageIcon = value; }
}
}
}

If you create a graphics dataset, you can now apply this renderer to your individual FeatureGraphicsLayers. You can easily extend it to use any of the existing attributes in the DataRow to determine which image icon to use, making it a simple thematic map renderer.

Points are simple to render, but it gets slightly trickier with lines and polygons. We will have to convert these to a System.Drawing.GraphicsPath instance that the graphics object knows how to render. This is fairly straightforward, but to save you the trouble here are the methods needed to perform this conversion:

public static GraphicsPath PolygonToPath(Polygon polygon)
{
GraphicsPath path = new GraphicsPath();
foreach (Ring p in polygon.Rings)
{
path.AddPolygon(pointCollectionToPointArray(p.Points));
foreach (Hole ring in p.Holes)
path.AddPolygon(pointCollectionToPointArray(ring.Points));
}
return path;
}

public static GraphicsPath PolylineToPath(Polyline polyline)
{
GraphicsPath path = new GraphicsPath();
foreach (Path line in polyline.Paths)
{
path.AddLines(pointCollectionToPointArray(line.Points));
}
return path;
}

private static Point[] pointCollectionToPointArray(PointCollection points)
{
Point[] pointArr = new Point[points.Count];
for (int i = 0; i < points.Count; i++)
{
pointArr[i] = new Point(Convert.ToInt32(points[i].X), Convert.ToInt32(points[i].Y));
}
return pointArr;
}

This is essentially all we need to make a renderer supporting all geometry types. Example:

using (GraphicsPath path = PolygonToPath(polygon)); //or PolylinetoPath for polylines
{
using (Pen pen = new Pen(System.Drawing.Colors.Black,1))
{
graphics.DrawPath(pen, path);
pen.Dispose();
}
path.Dispose();
}

If you want to show the feature with a fill, remember to also use FillPath prior to drawing the outline as shown above:

using (SolidBrush brush = new SolidBrush(System.Drawing.Colors.Red))
{
graphics.FillPath(brush, path);
brush.Dispose();
}

Using the principles described in this article, I’ve created a 2.5D renderer that can extrude polygons and lines based on a numeric attribute. The effect is very much like what you might have seen Google Maps using to show simple building outlines in metropolitan areas. You can indeed use it for this, or you can choose to extrude polygons based on for instance population density or whatever you want to show. I won’t go through the details of the code here, but most of the code is used for building a 3D-like mesh of a polygon and figuring out how to shade it depending on the direction of an imaginary light-source.

Adding support for legends

As mentioned in the beginning, we skipped implementing support for the table of contents control, and in many use cases of custom renderers (like displaying results) this is not needed. However adding support for TOC is fairly straightforward.

We can reuse existing functionality in the ADF to render our symbols. Let’s say we have a point layer using three image symbols, 1.gif, 2.gif and 3.gif. We use the RasterMarkerSymbol and the SwatchUtility to render our swatches.

public 
SwatchCollection GenerateSwatches(SwatchInfo swatchInfo, string fileName, string minScale, string maxScale) {
SwatchCollection
swatches = new SwatchCollection(); SwatchUtility
swatchUtil = new SwatchUtility(swatchInfo); for(int
i= 1;i<=3;i++) {
CartoImage img = swatchUtil.DrawNewSwatch(new RasterMarkerSymbol(
Server.MapPath(string.Format("~/images/{0}.gif", i))), null);
swatches.Add(new Swatch(img, "Marker #" + i.ToString(), null, null));
}
return swatches;
}

This will return a collection of 3 images to use for the legend. When adding a TOC to the page, you’ll see something like the following:

Swatch images in TOC

Get the Custom Renderer sample from the Code Gallery

Contributed by Morten Nielsen of the ArcGIS Server .NET software development team.

Posted in Services | Tagged , , | 2 Comments

New at 9.3 – Spatial Analyst improvements

The Spatial Analyst at 9.3 has several new capabilities, improvements, and fixes. This post highlights some of the important changes; for a full description, see the What’s New pdf document (Once open, in the Extensions section click on Spatial Analyst. This will take you to the right location in the document.)

Continue reading

Posted in Analysis & Geoprocessing | Tagged , | Leave a comment

ArcGIS Server 9.3 Nationwide Seminar Series occurring now

ESRI has been working on two, half-day
ArcGIS Server 9.3 Seminars
. These seminars started September 23rd and
are taking place through November within the U.S. This is a great opportunity
to see how to implement ArcGIS Server to its fullest capabilities.

The first seminar, which takes place during the morning, is “Tips and Tricks”.
It was derived by gathering the most common questions people have when
implementing ArcGIS Server and best practices. There are three main sections:
configuration and management, caching, and geoprocessing. This seminar provides
useful tips for configuring ArcGIS Server and understanding architecture, how
you can set up caching strategies and workflows for high performing web
applications and how to author and publish geoprocessing services for advanced
analysis over the web.

The second seminar, which takes place during the afternoon, is titled “Creating
Mashups Using the ArcGIS API for JavaScript”. The ArcGIS Server API for
JavaScript is new at 9.3 and provides html and JavaScript developers a quick
path for making great web mapping applications. This seminar covers the basics
and getting started with the API for JavaScript. In addition to creating
mashups, discussion on query tasks, geoprocessing, geocoding and other topics
are covered so you can see how GIS analysis can be done over this easy to use
API. You can take a quick glance of the demos that will be discussed by
downloading the sample code from the ArcGIS JavaScript API
Code Gallery
.

Both seminars provide a great resource for maximizing the potential of ArcGIS
Server. The seminars also provide workbooks to attendees so they can revisit
the useful tips back in the office. Sign up online to attend an
ArcGIS Server 9.3 Seminar
.

The ESRI technical staff hope to see you at a seminar in a city near you!

Contributed by Jeremiah Lindemann, co-designer of the “Creating Mashups Using the
ArcGIS API for JavaScript” seminar.

Posted in Services | Tagged , , , , , , | 2 Comments

ArcGIS Mobile Live Training Seminars Today

The first live training seminar for ArcGIS Mobile was at 9:00 PDT and there are only 2 left (11:00am PDT and 3:00pm PDT) so make sure you don’t miss this opportunity!!

We had over 500 connections to the first seminar and a lot of you asked questions. We are going to collate all questions that come in and cover them here on the blog so please make sure you log in and participate!

Posted in Mobile | Leave a comment

ArcGIS Mobile Live Training Seminar Tomorrow!!

Tomorrow you will have the opportunity to hear Myles and Sabine present a free Live Training Seminar that highlights the key features of ArcGIS Mobile at the 9.3 release.

Today Jim Barry from the EDN team had the opportunity to get behind the scenes as they rehearsed for tomorrow. Here is a short interview with Myles and Sabine about ArcGIS Mobile and what you can expect from the LTS. Click on the picture below to see the preview video.

You can find details on the live training seminar here.

Posted in Mobile | Leave a comment

"Optimizing" your 3-D display

By Charlie Frye, Esri Chief Cartographer

3D Thumbnail

When cartographers talk about “optimizing a computer display”, they’re usually talking about how to see things better, i.e., remove fuzziness, ensure all the information is shown, etc. This contrasts with how computer technology folks use the term “optimize”, which usually means make the screen display draw faster.
Continue reading

Posted in Mapping | Tagged , | Leave a comment

.NET Team adds API Evaluator

A quick post today about a new tool that the .NET team developed. The API evaluator scans your .NET code and generates a complete set of API usage statistics. This is pretty cool if you want to see what APIs are being used most frequently in your applications. It also provides a way for you to send feedback directly to ESRI about the APIs that are most important to you. 

Posted in Geodata | Tagged , , | Leave a comment

Introduction to ArcGIS Mobile 9.3 Live Training Seminar!

If you are new to ArcGIS Mobile or have used ArcGIS Mobile 9.2 and want to quickly get up to speed with what the mobile team developed for the 9.3 release, you are in luck! We are going to present a no-cost live training seminar on Thursday October 2nd. That’s two days from now!!

Myles Sutherland and Sabine Barrera from the Mobile team will provide an overview of Mobile GIS, introduce you to the new ArcGIS Mobile application and explain how you can use ArcGIS Server to create and manage your mobile projects. You will have the opportunity to ask questions as well.

The seminar will run 3 times on Thursday at 9:00AM, 11:00AM, and 3:00PM (PDT). You might be asking what you need to do to tune into the seminar. Well all you need is a good broadband internet connection and an ESRI Global Account.

You can find details on the live training seminar here: Introduction to ArcGIS Mobile 9.3

Mobile Team

Posted in Mobile | Leave a comment

WGA Video Now Online

ESRI President Jack Dangermond’s presentation at the Western Governors’ Association meeting in Jackson Hole, Wyoming, has recently been posted in the Showcase area of the ESRI GIS for Conservation Web site.

The video of the presentation includes recordings of demonstrations using ArcGIS Explorer, ArcSketch, and a Web application built using the ArcGIS JavaScript API

We covered the elements of the ArcGIS Explorer presentation in an earlier post, but the entire presentation is now available online, and tells a compelling story about protecting wildlife habitat areas, managing natural resources, and how GIS can be used to solve and mitigate the sometimes competing issues and problems that arise. 

Posted in Uncategorized | Tagged , , | Leave a comment