Archive for August, 2009

Getting Started with ESRI GeoProcessing Using Ruby

Friday, August 21st, 2009

So ESRI has chosen Python as their language of choice for GeoProcessing. Some of us however, prefer other languages to Python.  (Disclaimer: If you like Python that’s fine, I just prefer Ruby given my current circumstances).  So a quick look a the ESRI GeoProcessing documentation makes it clear that the GeoProcessing object is merely a COM object and should work in any COM compliant language. It just so happens Ruby can handle COM objects just fine in my experience. I have been using Ruby to do my GeoProcessing for some time now, but I have seen very little about this online and there is no section in ArcScripts for Ruby users.  So I decided to take it upon myself to start making some information and examples avaialble. I’ll try to continue to post examples and thoughts as I have time in the future. If there is anyone else out there using Ruby for GeoProcessing who has something to share please feel free to contact me. I’d be happy to post other peoples example/thoughts/experiences as well. In the meantime, here is part one, a brief intordution to using Ruby for GeoProcessing:

Ever find yourself with 100 KMZ files when you wanted KML files?

Monday, August 17th, 2009

So the other day someone sent me about 100 KMZ files that he had made by pinning points in Google Earth. He then said “Can you do….with these files?” The exact details don’t really matter, point is KML files are super easy to parse and work with compared to their zipped KMZ counterparts. Anyway, I didn’t feel like clicking on them all to unzip them and then rename them (Google Earth names the internal KML file doc.kml if you didn’t know that already). Since I had 7-zip installed I figured I’d write a quick script to unzip them and rename the doc.kml file based on the name of the KMZ file it came from. Ruby to the rescue; in just a matter of minutes I had my solution and it worked out really well. Anyway, if you ever find yourself in this boat here is the code I used: