I had a user with a series of GPS points (that were in chronological order) that they wanted to know the accumulated distance from the start to each point in their shapefile. First, we calculated the distance from each point to the previous point into a field called [DistFt].
Then, we hacked out this quick python function to accumulate the total distance in Arcmap’s Field Calculator:
In building our Enterprise GIS Database, we need to support users with different needs. Some of our users just need to see the data on a map while others may want to download a copy of the data so they can use it within their own desktop system.
After doing some exploring, one of the options that looks like it will feel the bulk of our internal needs is to create a Map Service/Geodata Service pair–by creating a Map Service, we can make an easy-to-use visual representation of our data. Combining that with a paired Geodata Service–a Geodata Service with the same name as the Map Service–we can accommodate those users who want to extract the data to their hard drive.
A user who has added paired Map & Geodata Services to an ArcMap dataframe can use the Distributed Geodatabase Toolbar to extract data to a local geodatabase. The Extract Data button is on the far right of the Distributed Geodatabase Toolbar.
Unfortunately, my first attempts at testing this did not work. It would look like it was processing, I would end up with a .mdb or .gdb file on my hard drive but I could not open it. I would get a “Failed to connect to database. This release of the GeoDatabase is eitehr invalid or out of date. [Unknown GeoDatabase release.] The Microsoft Jet database engine cannot find the input table or query ‘GDB_ReleaseInfo’. Make sure it exists and that its name is spelled correctly.” error.
When exporting to an .mdb file, I could open it in Access and see the data.
Luckily the error is fairly helpful–I was getting an ArcGIS 10 Geodatabase even though I am running ArcGIS 9.3.1 on my desktop. I was able to open the exported geodatabases using a copy of ArcGIS 10 on another machine. The reason for the inconsistency is pretty interesting. Our office is, and for the foreseeable future, running in a mixed-version environment. We have a mixture of 9.3.1 and 10 desktops, a 9.3.1 ArcSDE server and a 10 ArcGIS Server. The Extract Tool is a server-side function apparently that creates a version 10 Geodatabase.
The way to get around this is to extract the data to XML and then import the XML workspace into a geodatabase. Not sure if that will work for all schemas but it was successful for me.
We finally installed an instance of ArcSDE 10 today. My first attempt at connecting in ArcCatalog 9.3.1 failed with the following error:
Failed to connect to the specified server.
This release of the GeoDatabase is either invalid or out of date. [Please run the
ArcSDE setup utility using the -o install option.]
DBMS table not found[sde.sde.GDB_Release]
Turns out the solution was simple, this article points out that Service pack 2 is required. After updating my ArcGIS, the problem was solved:
I was the proud, new recipient of a non-misleading error message. After some minor head-slapping, I realized that 9.3.1 and older versions of ArcGIS are not able to connect to ArcSDE 10. Doh! My bad–I should have read ESRI’s clear information on this topic. At least I never actually tried to install ArcSDe with the -o option as the first error message instructed me to do.
Related to my post on how I enable a script to accept parameters from different sources, I also often set up pythons scripts to output information a variety of ways. This is largely due to the fact that some are called by ArcToolbox scripts. Running in ESRI’s domain, these scripts need to send the output through the arcgisscripting object but if you are running the python outside the ArcGIS framework, you can just print.
If you assume one output method but then run your code in the opposite framework, you don’t get to see all the pretty little messages. What I do is create a simple little routine that broadcasts the message both ways. This is probably an obvious solution but took a few cases before I went ahead and started implementing it.
gp = arcgisscripting.create()
#This will print both to the geoprocessing window or Python output window
<Code to do stuff>
#Ok, I want to send a message:
I’ve received a request on how to use the Zip Shapefile code I posted last week from ArcGIS. Sorry, I did not set the code up to call directly from ArcGIS but only as an illustration of how it can be done.
I have, however, with some minor tweaking, made a version that can added to ArcToolbox. The steps to install are below, please note that at one point I had you download a *.zip file that had been renamed to *.jpg–this should now be corrected and the link should lead you directly to zipshapefile.zip. Because of this steps two and three are obsolete.
1) Download the code from here.
2) Rename the file from zipshapefile-zip.jpg back to zipshapefile.zip.
3) Unzip the file.
4) Move ZipShapefile.py to C:\Program Files\ArcGIS\ArcToolBox\Scripts\ZipShapefile.py.
5) Optionally, move Zip Shapefile.tbx, perhaps C:\Program Files\ArcGIS\ArcToolBox\Toolboxes.
6) Add the toolbox to ArcToolbox. ESRI has instructions here on how to do this.
You should now have a new toolbox named “Zip Shapefile” with a script named “Zip a Shapefile” in it. Clicking on on the tool will bring up this dialog.
In response to Chris:
I believe you need to copy the ZipShapefile.py file from the .zip that you downloaded to C:\Program Files\ArcGIS\ArcToolBox\Scripts\, the error message is consistent with the tool not being about to find the python script there.
If you prefer to place the ZipShapefile.py in a different location, you will need to change the source on the tool. To do this, right click on the tool in ArcCatalog and change the path of the Script File as set in the Source tab (see below):
Came up with another error while running TopoToRaster but this time ArcGIS gave an error message that led to a solution. Turned out all my contour lines had an elevation of 16 which TopoToRaster did not like. I had intended to increase the elevation and inadvertently set them all to sixteen. I had saved the previous values before editing so it turned out to be a simple fix and I didn’t have to spend a day trying figure out what was wrong.
Stumbled across ArcBruTile, an ArcMap application that allows you to display map tile services–such as OpenStreetMap, Google Maps, Bing, Spatial Cloud, and Tile Map Service (TMS)–in your ArcMap documents. It works pretty well from my preliminary testing of it. I have found that at times that the graphical tiles are distorted but I am guessing it is because they are optimized for display in a specific projection, at specific scales and, in ArcMap, you can use any projection/scale combination you want.
This is a free, open-source project that is still in Beta but definitely an application I plan to keep an eye on. As with any open-source project, the cool thing is the code is available for you to look at, learn from, and hopefully contribute to.