New Code Gallery Download: Geodatabase Domain Tools

 

A new sample has been added to the code gallery that shows how the Geodatabase API can be leveraged to provide greater control over domains than what is possible with ArcCatalog out-of-the-box. It contains a custom geodatabase property page, written in C#, which when installed will appear alongside the existing Domains property page. The page provides the following functionality:

 

  • For ArcSDE geodatabases, displaying the owner of domains
  • Sorting and reordering coded value domains
  • Finding and optionally removing references to domains
  • Exporting domains to XML workspace documents

 

Check out the sample HERE

 

 

 

Posted in Geodata | Tagged , , | 2 Comments

ArcGIS RIA Developers: A brief intro to HTTP debugging tools

We wanted to introduce you to a few important tools for your HTTP debugging toolbox: Fiddler and Firebug. If you are building Internet applications, these tools can help take a lot of the guess work out of questions such as “Why isn’t my app connecting to the ArcGIS Server REST endpoint?” Or “Why isn’t my map loading when I open the app in a browser window?”

Here is an overview of each tool:

Fiddler
-    Built for .NET-based machines, but it works with both Internet Explorer and Firefox.
-    Installed as a standalone application.
-    Logs all HTTP and HTTPS traffic between your local machine and the internet.

Firebug
-    Works with FireFox and installs as a browser add-on.
-    Includes HTTP monitoring, JavaScript debugging, HTML editing, as well as CSS and DOM inspection capabilities.

Both Fiddler and Firebug let you examine many different aspects of the HTTP connection such as URL pathnames, error logging, as well as information contained in the request/response headers and response body.

To find more information on all the other useful features included with these tools, be sure to check out the Fiddler docs and the Firebug docs. But, if you just want to look “under the hood” and see what’s going on with your Internet applications, then these are the right tools for the job, and they may save you a lot of time when diagnosing problems.

 

Posted in Developer | Tagged , | Leave a comment

Updated 2009/2014 demographic reports are now in ArcGIS Buiness Analyst Online

 by Brenda Wolfe

We are pleased to announce the release of 2009/2014 reports in the latest version of ArcGIS Business Analyst Online.

Our demographers, statisticians and economists have been working hard to bring you the latest demographic and marketplace estimates and projections.  In this economic climate, who isn’t curious about what the future will hold?

These updated reports are only available in the latest version of ArcGIS Business Analyst Online.  In conjunction with the data update, this next generation of the product is now available to everyone!  Both Subscribers and Guests can now order reports and explore the new user interface.

If you are not familiar with the new version of ArcGIS Business Analyst Online, check out this three-minute video.  If you don’t have the free QuickTime player, you can download it here.

You can also click the Quick Start Video on the Home Tab of the application.

In addition to the much anticipated data update, there are some new product features to try out in this next generation of ArcGIS Business Analyst Online.

  • Interactive color-coded mapping of more than 1600 demographic, consumer spending and business variables to help you better understand the market
  • New workflows for creating sites and getting reports
  • Preference options for streamlining the application to the way you want to work.
  • Easier importing of addresses stored in Excel spreadsheets
  • Easier importing of both point and polygon shapefiles
  • A new folder-based approach to organizing sites
  • Improved map look and feel

Give it a try!

Posted in Location Analytics | Tagged , , , , , | Leave a comment

Recent Ed Comm Explorer posts

Here’s a couple of recent posts on the ESRI Education Community site that may be of interest to Explorer users.

Fun with GIS using AGX: prepping for hurricanes is a post by Charlie Fitzpatrick, ESRI education manager, that covers using NOAA’s nowCoast services. Those are published using ArcIMS, and are among the many kinds of mapping services that Explorer can use.

 

Joseph Kerski takes a look at the regional spatial distribution of two businesses in Explorer using business data imported from a spreadsheet.

 

 

Posted in Uncategorized | Tagged , | Leave a comment

Spatial Reference, GPS and GeoTransformations…

In this article we will explain the Spatial Reference object model and highlight what you need to know in order to build effective mobile applications that leverage the complexity of coordinate systems and the transformations between them.

Also find with this article a recent posting to the code gallery by Sabine Barrera that illustrates how to transform GPS positions from WGS84 into the spatial reference of a mobile service. 

DISCLAIMER: This is not for the faint of heart and the discussion implies that you have good foundational knowledge on map projections in ArcGIS. Here is some very well written background information that you can read on the subject.

Mobile Spatial Reference

A Mobile Service is both a web service and a data source in ArcGIS Mobile. The Mobile Service is your gateway to a map document that was published with “mobile data access” capabilities and as a data source it contains the map data that you have requested and cached on the client as the edits you have made in the field.

When thinking about the mobile service, it is important to understand that the mobile service always references the “active” data frame in a map document. That data frame contains a set of map layers and has a spatial reference and precision associated with it. Note that since ArcMap supports “projection on the fly”, the spatial reference of the data frame may be different than the spatial reference of the map layer’s data source. The Mobile SDK operates in the spatial reference of the data frame.

Within the ArcGIS Mobile SDK you will find the classes necessary to access the spatial reference of the mobile service. Here is an object model diagram that illustrates the classes available:

The spatial reference class itself provides access to the string defining the coordinate system, the current geotransformation, and a collection of supported geotransformations as well. The spatial reference class supports the following projections at the 9.3.1 release: Lambert Conformal Conic, Transverse Mercator, Albers, Mercator, Double Stereographic, and Oblique Mercator. Note that spatial reference implementation for the Mobile SDK is the exact same spatial reference engine used inside of ArcGIS Engine/Desktop, however a subset of all projects are contained in the mobile engine for performance reasons.

The spatial reference class also contains methods to convert between WGS84 coordinates and the spatial reference of the mobile service. Most conventional GPS systems use WGS84 – hence the explicit methods for converting between WGS84. Please note that we are enhancing this functionality in the 9.4 release. More on this as we come closer to the release of 9.4.

The spatial reference itself is stored within the MapSchema.bin file that is located inside of the mobile cache directory. It is created when the mobile service is opened using MobileService.Open(). The map schema contains additional information about the map including the map name, full extent, initial extent, layers and their workspaces. It is important to note that the precision of the mobile cache is derived directly from the full extent property of the map. By default (in ArcMap) the full extent of the map is defined by unioning the extent of all layers in the map document. This can lead to coarse precision if your feature classes span a very large extent. You can constrain the full extent and increase precision of your cache by setting a custom full extent for the map.

Datum Transformations

If you plan to leverage GPS in your mobile application, you need to think about datum transformations!! Most GPS systems use WGS84, and as a result, the GPS components in ArcGIS Mobile assume WGS84. The map that you publish as a mobile service may not be. If it is not, and you do not apply a geotransformation when projecting the GPS positing on top of the mobile service, you will find that the location is NOT where it should be!!

If, however, you do set the coordinate system in the map document to WGS84 then no transformation need be applied. When no transformation is applied, the MobileService.SpatialReference will return “Direct” as the value for the geotransformation.

The Mobile SDK supports the following transformation methods: Direct, MolodenskyBadekas, MolodenskyAbridged, Molodensky, GeocentricTranslation, CoordinateFrame, PositionVector, LongitudeRotation and BursaWolf. Note that Grid or file-based methonds (NADCON/HARN and NTv2) are not supported.

Specifying the transformation in ArcMap

As mentioned above, if your map is not using WGS84, a datum transformation will be required to convert GPS positions from WGS84 into the datum of your map. For example, if the coordinate system of the map is GCS_Deutsches_Hauptdreicksnetz, the author of the map will need to specify a transformation that will convert from GCS_WGS_1984 into GCS_Deutsches_Hauptdreiecksnetz.

If none of the data sources in the map are in WGS84, you will need to add a datasource that is. This will enable the Transformations dialog in ArcMap so that you can easily set the transformation. When a source is added to the map, a geographic coordinate systems warning will appear. Click on the “Transformations…” button and select GCS_WGS_1984 in the “Convert from” list box and then choose a transformation. You can now remove the WGS84 layer from your data frame and save the map document – your transformation will still be available.

In the example above, DHDN_To_WGS_1984_3s was selected. For this map and published mobile service, the spatial reference will use this transformation to convert GPS positions to your coordinate system. The MobileService.SpatialReference.CurrentGeoTransformation will return “DHDN_To_WGS_1984_3x”. If you have not specified the transformation, it will return “Not Defined” and your GPS positions may be quite off.

Converting Data Sources to WGS84

If you want to project your data source from its existing datum to WGS84, you can use the Project Geoprocessing Tool that is located inside ArcToolbox under the Data Management Tools > Projections and Transformations > Feature.

Specifying the Transformation in your Mobile Application

If you need to specify the transformation in your mobile application, you can implement a Wgs84GeoTransformation. The code below shows how to implement a transformation from WGS84 into German Zone 4.

This transformation string will set the required parameters used. The geotransformation is shown in the WKT form first.

// 108206 GEOGTRAN["DHDN_To_WGS_1984_3x", GEOGCS["GCS_Deutsches_Hauptdreiecksnetz", DATUM["D_Deutsches_Hauptdreiecksnetz",
// SPHEROID["Bessel_1841",6377397.155,299.1528128]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]], GEOGCS["GCS_WGS_1984",
// DATUM["D_WGS_1984", SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0],
// UNIT["Degree",0.0174532925199433]],
// METHOD["Position_Vector"],
// PARAMETER["X_Axis_Translation",597.1],
// PARAMETER["Y_Axis_Translation",71.4],
// PARAMETER["Z_Axis_Translation",412.1],
// PARAMETER["X_Axis_Rotation",0.894],
// PARAMETER["Y_Axis_Rotation",0.068],
// PARAMETER["Z_Axis_Rotation",-1.563],
// PARAMETER["Scale_Difference",7.58]]
double[] parameters = new double[10];
// XTranslation
parameters[Wgs84GeoTransformation.XTranslation] = 597.1;
// YTranslation
parameters[Wgs84GeoTransformation.YTranslation] = 71.4;
// ZTranslation
parameters[Wgs84GeoTransformation.ZTranslation] = 412.1;
// XRotation
parameters[Wgs84GeoTransformation.XRotation] = 0.894;
// YRotation
parameters[Wgs84GeoTransformation.YRotation] = 0.068;
// ZRotation
parameters[Wgs84GeoTransformation.ZRotation] = -1.563;
// ScaleTranslation  or ScaleDifference
parameters[Wgs84GeoTransformation.ScaleTranslation] = 7.58; 
// The following parameters are only use by the MolodenskyBadekas method
// XCenterRotation
parameters[Wgs84GeoTransformation.XCenterRotation] = 0;
// YCenterRotation
parameters[Wgs84GeoTransformation.YCenterRotation] = 0;
// ZCenterRotation
parameters[Wgs84GeoTransformation.ZCenterRotation] = 0; 
// This Wgs84GeoTransformation constructor requires a spatial reference,
// the name of the new transformation, the transformation type, if the
// transformation is forward (from a coordinate system to WGS84) or backward
// and the transformation parameters
customGeotransformation = new Wgs84GeoTransformation(mobileService1.SpatialReference,  “DHDN_To_WGS_1984_3x”, GeoTransformationType.PositionVector, false, parameters); 
// Add the new transformation to the collection of GeoTransformations in the SpatialReference

mobileService1.SpatialReference.GeoTransformations.Add(customGeotransformation);

 

// Set the current GeoTransformation Index to the be just added

mobileService1.SpatialReference.CurrentGeoTransformationIndex = mobileService1.SpatialReference.GeoTransformations.Count – 1;

Thanks to Sabine for contributing content for this posting. Our apologies for the length. We hope it helps your application development…

Mobile Team

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

User Template Submissions

We’ve had a few questions about whether users and ESRI business partners can submit templates to the Water Utilities Resource Center.  We wanted to tell everyone, the answer is yes!

We are encouraging our users and business partners to submit templates to the Water Utility Resource Center template gallery.

Keep in mind there are 5 items that a template must have and all of these items must be in your template zipfile:

1. An instruction document – with information on how to install and configure the template. Including what software is necessary.

2. Any MXD or MXDs necessary – the mxds are critically important to show everyone your cartography, geoprocessing tools, etc.

3. Any custom code – Including the source code.

4. Sample Data – a populated geodatabase with any necessary data for your template. This is so everyone can understand how your template works with sample data. If you can’t share your own data than you can use the sample data we’ve provided with the Mobile, Editing or Dashboard templates for your template.

5. A blank geodatabase – this is an empty geodatabase with the same schema as your sample geodatabase.

Here is an example of the folder structure your template should follow:

A few ground rules for submitting templates – we will review each template to ensure that the proper items are in them and they function as advertised.  We won’t accept any templates that have trial software applications or extensions in them or don’t have the source code if there was custom programming in your template.

So anyone ready to share your good work?

If you have any questions about how to create your own template and post it email us at ArcGISTeamWater@ESRI.com

Posted in Water Utilities | Tagged , , , , , , , | Leave a comment

Where do crash reports go?

by Kyle Watson

All software programs can ‘crash’ from time-to-time, including ArcGIS.  In the event that ArcGIS does crash you can send an automated error report to Esri.  Ever wonder where ArcGIS Business Analyst desktop crash reports go?  Well, they come to me!  If you are using Business Analyst and a crash occurs, each report funnels their way to my inbox.  From there, we take a look and attempt to diagnose the problem, eventually improving the software in service packs or future builds.  Some are easy, some more complex as there are countless reasons for a potential crash.

Here’s a tip.  Do fill out your email address in the space provided.  Otherwise we have no idea where these come from.  With your email address handy, we can offer you a possible solution if we target the probable issue.  Other than that your contact info is confidential.

 

Cheers, Kyle

Posted in Location Analytics | 1 Comment

Releasing Geodatabase cursors

Data access is crucial to any application. We create geodatabase cursors to create/edit/delete/query the data in a table or a feature class. Like any other database cursor, a geodatabase cursor is also a simple iterator that allows you to access data sequentially. If you are new to geodatabase cursors, you can learn more about cursors, its different types and best practices in our SDK topic on cursors.

One of the crucial best practice when working with Geodatabase cursor is to release the cursor that you created using Cleaner.release() method. If you ignore to release your geodatabase cursor, you will encounter errors and exceptions that will prevent you from opening the tables and feature classes eventually in your application. I have provided a simple snippet that creates and releases cursors below.

private void searchCursors(String gdbLocation, String fcName)throws Exception{

    //Create a workspace factory
    IWorkspaceFactory wksFactory=new FileGDBWorkspaceFactory();
    //Create a workspace
    IFeatureWorkspace workspace= (IFeatureWorkspace)wksFactory.openFromFile(gdbLocation, 0);
    //create a feature class
    FeatureClass featureClass=new FeatureClass(workspace.openFeatureClass(fcName));
    //Retrieve all features and enable recycling
    IFeatureCursor featureCursor=null;

    try {
        featureCursor=featureClass.search(null,true);
        IFeature feature=featureCursor.nextFeature();
        while(feature!=null){
            //do something with cursor
            feature=featureCursor.nextFeature();
         }
    }

    catch (IOException e) {
        e.printStackTrace();
    }

    finally{
        //Release the cursor
        if (featureCursor!=null){
            Cleaner.release(featureCursor);
        }
    }
}

We create many cursors in a geodatabase application and if the cursors are not released immediately, they get accumulated to the point where you will not be able to open the table or feature class further. We cannot rely on our Java garbage collector since it is non-deterministic in every way! Luckily, we can take advantage of the COM world and release the underlying COM reference to the geodatabase cursors using Cleaner.release() method. So, if you release your cursors appropriately, you cancreate as many cursors as you like!

Now that we have learnt about why we need to release cursors, can you spot the mistake in the code snippet below?

private void cursorRelease(IFeatureClass featureClass, IQueryFilter queryFilter1, IQueryFilter queryFilter2){

    IFeatureCursor featureCursor=null;
    try {

        //Create cursor based on queryFilter1
        featureCursor=featureClass.search(queryFilter1, true);
        IFeature feature1=featureCursor.nextFeature();
        while(feature1!=null){
            //do something with cursor…
            feature1=featureCursor.nextFeature();
        }

        //Create another cursor based on queryFilter2
        featureCursor=featureClass.search(queryFilter2, true);
        IFeature feature2=featureCursor.nextFeature();
        while(feature2!=null){
            //do something with cursor….
            feature2=featureCursor.nextFeature();
        }
    }

    catch (IOException e) {
        e.printStackTrace();
    }

    finally{

        if (featureCursor!=null){
            Cleaner.release(featureCursor);}
    }
}

We have created two cursors above, one based on queryFilter1 and another based on QueryFilter2. On successful execution of the code above, the Cleaner.release(featureCursor) in the finally block will release the cursor reference that was created for queryFilter2 ONLY. However, the first cursor that we created will not be released. The code needs to be modified to release both the cursors. Give it a try and remember to release every cursor reference that you create!

Posted in Developer | Tagged , , | 1 Comment

Checksum explained…

Even though the server and the mobile client device have a great relationship, every time they meet they need to shake hands and identify themselves before doing any work together. We call this handshake a “checksum”. The nature of the relationship is that the mobile client is always approaching the server and asking it for something – either to request map data from it or to post some changes it has made to the server’s data. For this reason, it is important for the server to make sure that the mobile client properly identify itself so that it can fulfill its request as best it can.

The way that the server can verify the identify the mobile client is by how it was created – by using the Map Document that was published as a mobile service. When a mobile client makes a request, the server interogates its signature, the map schema, and compares the number of map layers, certain properties of the feature layers in the map, the the feature class definition for each feature layer, and the spatial reference of the map. It is very thorough in its checking! 

If any of these properties have been changed since the map schema was created for the mobile client, the server will not accept its requests and instead return a “checksum error” when it shakes hands!

Publishing Best Practices

It is extremely important that when you publish a mobile service, that you treat that relationship between the map document, the mobile service, and any mobile caches created from it as a binding contract between the three. 

It is recommended that you:

  1. Create and author a map document specific for the mobile service you intend to publish.
  2. Make a copy of that map document if you plan to re-use it for other services (mobile, map or otherwise).
  3. Synchronize all mobile client caches that may have edits and delete the mobile caches before making changes to the schema.

Also note that if you do need need to make changes, it is recommended that you create and deploy new mobile caches so that your mobile application and projects can forge a new relationship with the server rather than trying to get all data from the field!!

Checksum Improvements

In 9.3.1, we made some minor improvements to the checksum process by not checking the extent of feature layers in the map. The extent of a feature layer can grow simply by adding data to the feature class that serves as its source. This was most notable when publishing a map with an empty map layer. In the 9.4 release, the handshake will be much more relaxed. The server will now focus its interrogation on the schema of the feature classes themselves and no longer cares to much about how layers dress themselves in a map document.

Saving Abandoned Edits and Mobile Cache to Shapefile Sample

So, if the mobile client has features to share back with the server and the server no longer wants to talk to it, what is the client to do?? Well this is a challenge. The mobile team has just posted a ”Mobile Cache to Shapefile Tool” on the code gallery. There is both a 9.2 version and a 9.3 version of this tool. The code sample will read in the mobile cache, lets you select a number of features from a given layer, and will create a shapefile from the selection. The features in that shapefile can then be imported into the geodatabase through ArcMap.

It is important to note that there are inherent limitations with shapefiles that do not exist with data that is stored inside of ArcSDE geodatabases. Field names, support for domains and subtypes, etc. This will be the subject of a more detailed article around this tool itself…

Please let us know if you have further requests/questions around the checksum.

Thanks,

Mobile Team

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

Raster Clipping – Part B – Using an irregular shape to clip a raster dataset

This is a follow up to last week’s post. Last week we talked about clipping raster datasets based on a single polygon or graphic.  This week we will look at clipping a raster dataset based on selected features within a feature class.

Sometimes you will have many polygons in a feature class and will want to use a specific set of features to clip your raster data. This can be done by creating a selection set within ArcMap.

First you will want to make a query or choose a selection set. In my example I will choose any feature that has an area of 5000 units or more. 

Now that we have the selection set, we will use the Clip (Data Management) geoprocessing tool, to clip out only the selected areas. Be sure to choose the polygon layer from the dropdown, and also to check the Input Features for Clipping Geometry checkbox.

After the tool has run, only the selected (blue areas) are clipped out. The other features that were not in our selection set will be excluded in the output.

Posted in Geodata | Tagged , , | 2 Comments