Pages

Thursday, October 13, 2011

ArcGIS 10: Change Default Editor for ToolValidator

Unfortunately, ArcCatalog does not respect the Editor and Debugger Geoprocessing Options when you edit a ToolValidator.Make a registry change (Windows 7) to change the default editor (for me it was IDLE) for the ToolValidator class.

Add an edit key to the shell key for Python.File:
HKEY_CLASSES_ROOT\Python.File\shell\edit\command

Create a new string value, and in the value put the path for your editor, for example if you set Notepad++:
C:\Program Files (x86)\Notepad++\notepad++.exe "%1"

Geoprocessing Options are ignored when editing the ToolValidator class:


It is possible to change the default editor for the ToolValidator class:

A new registry entry is required:

Friday, September 23, 2011

Laptop Running Hot and Slow

Is your laptop running really hot?
Does your laptop's performance seem non-existent?
Is your fan running really loud, but not much air is coming out?

It might be time to remove the dust bunny.



Monday, September 19, 2011

Javascript: Recursively Fetch All Documents Associated With Frames

A recursive Javascript function to get all objects of type HTMLDocument from all iframes in a document and all their children.  It might need some refinement.  For example, there is an HTMLDocument associated with iframe, when all you might want are the documents associated with the frames.


//Returns array including current document and all documents in all frames
function getAllDocuments()
{
documents = [document];
childDocuments = getAllChildDocuments(documents);
return documents.concat(childDocuments);
}

//Recursive function drills down into all iframe and frame documents
// docs: array of HTMLDocument types
function getAllChildDocuments(docs)
{
childDocuments = []
var docsLength = docs.length;
for (var docIndex = 0; docIndex < docsLength; docIndex++)
{
var iframes = docs[docIndex].getElementsByTagName("iframe")
var iframesLength = iframes.length;
if (iframesLength > 0)
{
for (var iframeIndex = 0; iframeIndex < iframesLength; iframeIndex++)
{
var iframeDocument = iframes[iframeIndex].contentDocument;
if (iframeDocument)
{
childDocuments.push(iframeDocument);
var frames = iframeDocument.getElementsByTagName("frame");
var framesLength = frames.length;
if (framesLength > 0)
{
for (frameIndex = 0; frameIndex < framesLength; frameIndex++)
{
var frameDocument = frames[frameIndex].contentDocument;
if(frameDocument)
{
childDocuments.push(frameDocument);
}
}
}
}
}
}
}
if(childDocuments.length > 0)
{
return childDocuments.concat(getAllChildDocuments(childDocuments));
}
return childDocuments;
}

Wednesday, September 14, 2011

Unable to Install Aptana Studio 3 Plugin for Eclipse

Problems:
Installation of Aptana Studio 3 Plugin for Eclipse (Indigo) stuck at 49%.
Difficulty installing Eclipse plugins, with error message "Comparison method violates its general contract!".

Solution:
Uninstall Java 7
Install Java 6 Update 27

Additional Notes:
There is mention in the references below of entering the following in eclipse.ini:
-Djava.util.Arrays.useLegacyMergeSort=true

Unfortunately, I was not able to get this particular solution to work. It would allow you to keep Java 7 installed, and is worth further investigation if uninstalling Java 7 is not an option.

References:



Thursday, September 8, 2011

How to Set Up Eclipse C++ with Cygwin

UPDATE:  This is most likely overkill except for custom configurations.  Eclipse should work without all these configuration steps, compilers are included in the plugin. 


1. Install eclipse along with CDT Eclipse plugin

2. Install MinGW.  During install, make sure to go into the development section and select gcc: g++, make, and GDB. This will cause their prerequisites to be installed, too.

3. Add “C:\cygwin\bin” to system path (for g++, make, GDB)

4. Create a new C++ project in eclipse

5. In the project properties, set the toolchain to "MinGW GCC":
a) Open Project Properties
b) go to C/C++ Build->Tool chain
c) Select MinGW GCC

References:
  1. http://www.ibm.com/developerworks/opensource/library/os-eclipse-stlcdt/#resources
  2. http://www.eclipse.org/forums/index.php/mv/tree/200049/#page_top
  3. http://www.eclipse.org/forums/index.php/mv/tree/167048/#page_top

Tuesday, July 19, 2011

python installation issues on 64 bit Windows 7

I was trying to install matplotlib on 64bit windows with Python 2.6 (32bit as part of ArcGIS 10.0) but the executable failed, barking that it couldn't find Python in the registry.

Creating and executing the following REG file to solve the problem:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Python]

[HKEY_CURRENT_USER\Software\Python\Pythoncore]

[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6]

[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\InstallPath]
@="C:\\Python26\\ArcGIS10.0"

[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\PythonPath]
@="C:\\Python26\\ArcGIS10.0;C:\\Python26\\ArcGIS10.0\\Lib\\;C:\\Python26\\ArcGIS10.0\\DLLs\\"

References:
  1. Valentine's tech log:  64 bit python installation issues on 64 bit Windows 7

Monday, May 23, 2011

Flex SDK 4 to 4.5 and ArcGIS Viewer for Flex

It is possible to use Flex SDK 4.5 in Flash Builder 4.0.1


Upgrading ArcGIS Viewer for Flex 2.3.1 to Flex SDK 4.5 produced the following errors:

1.Required skin state missing errors:


normalWithPrompt,  disabledWithPrompt

Solution:  Insert this right before the line with the problem:
[States("normalWithPrompt",  "disabledWithPrompt")]

Reference: http://forums.adobe.com/message/2574211


2. Minimized widget with large canvas

Solution here:
http://forums.arcgis.com/threads/29750-flex-sdk-4.5-support

Monday, January 24, 2011

ArcGIS Bug: Certain img files yield incorrect cell count totals

A coworker and I just ran into a problem with the reported cell counts of an img file. We were performing a mosaic using an img and a grid and we were checking the cell counts of the final raster and they seemed much too low. Come to find out, the totals for the img appear to be wrong.

We used the copy raster tool to copy to a grid. The cell count totals for the new grid are much lower than the original img. We copied the grid back to an img. The new img has the same cell count totals as the grid.

We hypothesize that there is some corrupted state an img can exist in, such that ArcGIS cannot properly count the cell totals, but it can still properly convert to different raster types.

Example File:
http://www.mrlc.gov/multizone_download.php?zone=6  (download "Landcover zip file")


ArcGIS Versions:
9.3, 10.0

References:
  1. http://forums.arcgis.com/threads/3672-Raster-Calculator-reduces-the-count-number?p=71411#post71411

Thursday, January 13, 2011

ArcGIS: Define Projection vs Project

In ArcCatalog, there are three projection related tools in ArcToolbox. These tools caused me confusion in the beginning, and they seem to cause others confusion as well.

Define Projection - This tool does not change a projection. It changes the metadata describing the current projection of the dataset. You should only use this tool if the projection is currently described as unknown or is known to be incorrect. With this tool you are defining or describing the dataset by saying "Hey, those points are in this projection."

Project - This tool operates on features to change the current projection from one defined projection to another. For example, if you have a point dataset in a UTM projection, each point has a pair of numbers describing that point. When you use this tool to change its projection, each number is recalculated to reflect its equivalent value in the new projection.

Project Raster - This tool operates on rasters to change the current projection from one defined projection to another.


Also, if you have a dataset and the projection is currently described as unknown, and despite all your Google searches, emails and phone calls, you can't determine what it is supposed to be, and you can't find an equivalent dataset with the projection properly defined, you can use the following method as an act of desperation to define it. Please, make sure you record in the metadata that the projection was "guessed at" so future users will know that there is uncertainty about whether the defined projection matches the projection that the coordinates belong to.

1. Create a new document in ArcMap.

2. Add a reference dataset with a defined projection (it cannot be defined as unknown, or be potentially incorrect)

3. Add your dataset with the unknown projection (make sure it is defined as unknown)

4. Right click on the map and select data frame properties

5. In the data frame properties dialog, select the Coordinate System tab

6. Remember, this is detective work. Go back and look at the point values themselves if needed. Do the coordinate values look like they are in meters or degrees? What is the state plane projection for this location?

7. Select a coordinate system that is your best guess for what the projection might be, click ok to exit the dialog

8. As you change the projection for the data frame, the reference dataset will continue to be in the correct location on the map by reprojecting on the fly (coordinates are recalculated in memory for the map, but the dataset on disk remains unchanged).

9. The dataset with the unknown projection will start hopping all over the place. No on the fly projection is happening for this dataset. It is placed on the map using its unaltered coordinate values.

10. After repeating this process, and your unknown dataset aligns perfectly with your reference dataset, you have LIKELY found the correct projection. I emphasize likely, because there is still uncertainty, and you should note this uncertainty in the metadata.


Monday, January 10, 2011

ArcGIS 10: Script Error After Clicking on Description Tab

Here is a weird ArcGIS 10 bug for you.

Problem:
A blank tool window and a blank script error window, but only after clicking on the Description tab in ArcCatalog. 



(Someone reported that this error also occurs when you edit the item description (add metadata) for a model or script and appears to also be fixed the same way)







Solution:
In internet options, accessible through internet explorer or the control panel, go under the Security tab and set the level to Medium. There are no more script errors. To experiment, I went back and set it to Medium-High, the script errors returned, back to Medium they're gone! 





References:
  1. ArcGIS Resource Center: ArcCatalog v10 Internet Explorer Script Error on page, Run ActiveX control