This blog has lain idle too long. About this time last year, I was gripped by fascination for GIS. Then there was work, studying for the ASBOG exam, getting my geologist license, having a baby, sleepless nights, and more work…
Now, I’m finally getting back to where I started. In spring of 2008, I took a Python course hoping it would be a tool for taking GIS to the next level. Unfortunately, I never got around to using any of it, and more than likely I have forgotten most of what I learned. I never got far enough into either ArcGIS nor Python to see how I could use them together. I still enjoyed the introduction to programming. So, now, I am hoping to get some use out of writing Python scripts for GIS.
Much of my recent GIS use, however, has been very simple. In fact, I am only using it to map borehole locations from engineering projects in Texas and then overlaying them on Texas geology (based on the Geologic Atlas of Texas). While doing so, the idea is to create a database of all boreholes from future, current, and past projects.
Originally I started plotting borehole locations in Google Earth. It seemed much more straightforward than going through ArcCatalog and creating a feature class from an Excel spreadsheet with X,Y data. So to get from Google Earth to ArcGIS, I started using Arc2Earth which can convert a Google generated KML file into a Personal Geodatabase file (*.mdb) for use in ArcGIS. Again, this process has been very straight forward (once you figure out that you can’t name your MDB starting with a numeric – instead the file name MUST start with a letter !)
Now, rather than entering X,Y data by hand in Google Earth or importing *.CSV data from your Excel spreadsheet, I wanted to create a simple KML file to use in Google rather than create it in Google. Turns out that’s easy. The most basic KML file for this purpose looks like this:
<?xml version=”1.0″ encoding=”UTF-8″?>
<name> For Example, Your Project Title </name>
<name> BOREHOLE NUMBER </name>
<Point> <coordinates>LONG, LAT</coordinates></Point>
You can add as many Placemarks (Boreholes) as you like. You can pack way more information into KML. But I wanted it simple. Although I have been doing this outside of Google or ArcGIS, writing a little script that would convert a 3-column ASCII file (Point,X-Coord,Y-Coord) into a KML file like the one above seemed useful. I started thinking about Python again.
But instead I wrote a short little Excel formula for the 4th columns that takes the information into KML, e.g.:
=CONCATENATE(“<Placemark> <name>”,A1,”</name><Point><coordinates>”,B1,”,”,C1,”,0″,”</coordinates> </Point> </Placemark>”)
which gives you a bunch of lines of KML, one for each location, that you can copy/paste into a KML template in notepad.exe and save.
I realize that once you’re dealing with 10,000s of data point, a little more automation may be useful. But my problem (or blessing?) while using ArcGIS has been that I have had no use so far for what I’d like to do – use Python ! Im hoping that I will find some problems where I can learn how to use it soon.