GeoChalkboard

A “Spatial” Education Blog

Archive for March, 2008

New Course Section: GIS Programming 101

Posted by epimpler on March 23, 2008

 Our GIS Programming 101 course scheduled for March 24th - April 18th is SOLD OUT.   Because the demand for this course has been so high we will be offering a second section of this course May 12th - June 6th. This is an instructor guided course taught in a Virtual GIS Classroom using the same technologies implemented by colleges and universities around the world to deliver Internet based courses. Our new Virtual GIS Classroom blends the best of instructor led and e-learning formats into a new instructor led web based format that allows for more interactivity between the instructor and student, and between students.

GIS Programming 101: Mastering Python for Geoprocessing in ArcGIS is designed to teach the fundamental programming constructs of the Python language and how it can be integrated with ArcGIS Desktop to automate geoprocessing tasks.  Course participants will be led through a series of 13 modules described below.
Module 1:  Getting Started with Python in ArcGIS
Module 2:  The Geoprocessor ArcObject
Module 3:  Basic Python Language Features
Module 4:  Obtaining Descriptive Information About ArcGIS Data
Module 5: Using Cursor Objects to Select, Edit, and Add Records to Tables and Feature Classes
Module 6:  Enumeration Objects for Listing ArcGIS Data
Module 7:  Miscellaneous Objects
Module 8:  Dynamic Scripts
Module 9:  Integrating Python Scripts with ArcToolbox
Module 10:  Geoprocessing Tools
Module 11: Scheduling Geoprocessing Tasks
Module 12:  Messaging and Error Handling
Module 13:  Final Project

Please click the link above for more information or to register.  If you have any questions please contact us at sales at geospatialtraining.com.

Posted in Uncategorized | No Comments »

Dynamic Geoprocessing Scripts

Posted by epimpler on March 18, 2008

Other posts in this series: 
Scripting Your ArcGIS Geoprocessing Tasks (Part 1)
Scripting Your ArcGIS Geoprocessing Tasks with Cursors (Part 2)
More ArcGIS Geoprocessing Concepts - Enumeration Objects (Part 3)
Obtaining Descriptive Information About GIS Datasets with ArcGIS Geoprocessing Objects (Part 4)
Executing ArcGIS Tools from Geoprocessing Scripts (Part 5)

Through the use of parameters, also known as arguments, you can pass data into your geoprocessing scripts.   The use of parameters makes your scripts more generic and flexible since they allow you to provide for the dynamic input of datasets, tool parameters, or to control the processing logic of a script.  For example, if you had a geoprocessing script that called the Buffer tool you would need to specify the input features, output feature class, and a buffer distance at a minimum.  To make your script more flexible you could take advantage of these dynamic features to input variable data sources and buffer distances depending upon the circumstance. 

In this post we will examine two methods for passing data into your scripts.  The first, GetParameterAsText( ) is a method on GpDispatch that allows you to pass parameters into your scripts through a tool dialog available through ArcToolbox.  We’ll also look at Python’s sys module which can also be used to pass data into a geoprocessing script.

GetParameterAsText( )

The GetParameterAsText method on the GpDispatch object can only be used with ArcToolbox. The advantage of using this method is that it provides for the use of a visual dialog that accepts input data from the user.  This input data is then retrieved inside your geoprocessing script through the GetParameterAsText method.  GetParameterAsText is zero based, with the first argument located at position zero, and each successive argument increments to the next largest integer (see figure below).

There are a number of advantages to running your scripts from ArcToolbox using GetParameterAsText. When you take this approach, the script becomes part of the geoprocessing framework which means that it can be run from a model, ArcGIS command line or another script. In addition, the script has access to ArcMap environment settings and help documentation. Other advantages include a nice user interface that is easier to use, and error prevention capabilities. Error prevention capabilities provided include a dialog box that informs the user of certain errors.

There are a couple negatives to using GetParameterAsText that I should point out.  As I mentioned above GetParameterAsText can only be used within ArcToolbox which means that you can’t execute a script using this method from PythonWin or a DOS prompt.  One additional negative to consider with GetParameterAsText is that it is more difficult to debug the scripts since they can’t be tested from PythonWin.

Python system Module
Python, like other scripting languages, provides a mechanism for accessing arguments passed into the script.  Python’s system, or sys, module is used to accomplish this task. Specifically, the sys.argv[] list contains the name of the script being executed along with any parameters being passed into the script.  As with any other list in Python you can access the parameters through an integer value.  This list, like GetParameterAsText, is zero based.  The difference is that the first item in the list references the script that is being run whereas with GetParameterAsText, the first item references an actual parameter value.  So, let’s take a look at a quick example. 

In this example we use Python from a command line prompt to start a script named PointDistance.py. In addition, we pass in three arguments to the script by including them on the same line, but separated by a space. The sys.argv[] function stores each of the arguments in a list which we can access. Notice that the first argument, referenced by the integer 0 contains the name of the script, PointDistance.py. The arguments that are passed into the script can then be referred to by each successive integer.  Each of these arguments can then be used in your script as necessary.

A similar script called from ArcToolbox:

More Information
We will be presenting a new Virtual GIS Classroom course, “GIS Programming 101: Mastering Python for Geoprocessing in ArcGIS” starting March 24th and ending April 18th.  We still have 1 seat available so hurry to reserve your seat now.  We do offer a 15% discount for government, educational, and non-profit entities.

We also offer an e-learning course entitled “Introduction to Geoprocessing with Python” which contains even more detailed information on ArcGIS geoprocessing with approximately 200 slides of audio and video lectures, visual software demonstrations, exercises and data. 

Posted in Uncategorized | No Comments »

Using Spreadsheet Mapper 2.0 with Google Earth & Google Maps

Posted by epimpler on March 11, 2008

Over the next few weeks I’m going to be writing a series of posts on some of the lesser know tools provided by Google for creating data layers in Google Earth and Google Maps.  The Google Earth Outreach program provides a number of these tools.  According to a press release from early last summer, Google Earth Outreach is “designed to help nonprofit organizations around the world leverage the power of Google Earth to illustrate and advocate the important work they do.”  The program includes comprehensive online guides, video tutorials, and case studies about using Google Earth specifically targeted to the needs of nonprofit organizations.  In addition, organizations can also apply for a Google Earth Pro grant ($400 value). 

In this initial post we’ll take a look at the Spreadsheet Mapper 2.0 tool created by the Outreach team for creating Google Earth and Google Maps placemark layers using Google Docs.  Google Docs is a great way to create, share and collaborate on documents, spreadsheets and presentations online.  Spreadsheet Mapper takes advantage of this online, collaborative environment by allowing you to create placemark layers for display in Google Earth and Google Maps through a spreadsheet created in Google Docs.  Because Google Docs is a collaborative tool, members of your team can simultaneously enter data and instantly publish updates to GE and GMaps.  So, let’s take a look at how this is done through a basic example.

In this example we’re going to create a placemark KML file containing existing Starbucks locations. The Starbucks data contains a unique identifer for each location along with the latitude, longitude coordinate pair and a physical address.  This data is contained within the “Starbucks No Linefeeds.csv” file which was last updated in January 2008. This file contains almost 9,000 Starbucks locations.  Since there are so many locations I’m only going to use a sample area for this example. The download also contains a Starbucks.bmp image which we’ll use in our next post in the series which covers Spreadsheet Mapper templates for styling icons and information balloons.  Let’s get started.  By default, Spreadsheet Mapper will use various templates to create some sample data.  We’ll do this first and then replace the sample data with our own Starbucks location data.

  1. Open the starter spreadsheet.  If you haven’t already done so you’ll need to login to your Google account or create one if necessary.
  2. Select File –> Rename and give you spreadsheet a name (”Starbucks Locations”).
  3. Fill in the “Author’s Information” and “About your KML Document” sections.
  4. Optional Parameters
    • Enable “Google Maps Compatibility” if you want the layer to work in Google Maps
    • Access the “Advanced/Optional Settings” by clicking the tab indicated on the left to un-hide rows
  5. Click the Publish tab and select Publish Now.  This step will publish the document to the web at the URL listed.
  6. Copy the publisher URL and paste it into the white cell provided under “Publish spreadsheet”.
  7. Copy the “Network Link KML” cell that you see below, open Google Earth, select My Places, then right-click and paste.
    Network Links capability in Google Earth provides for the delivery of dynamic data to your users.  We are using a Google Docs spreadsheet which can be edited by multiple users simultaneously.  Network Links in Google Earth are a perfect complement to a Google Docs spreadsheet since they can automatically refresh the Google Earth display to reflect updated data from a spreadsheet.  Get more information on Network Links in our “Mastering KML in Google Earth” e-learning course.So, at this point we’ve copied the sample data contained in the template into Google Earth.  You will notice a variety of folders, placemark icons and information balloons which have been created based on parameters found in the templates contained within Spreadsheet Mapper.

    The Spreadsheet Mapper comes with six templates that can be used to control icon and balloon styles.  Click any of the links at the bottom of the spreadsheet to get more information about each of these templates.  We’ll cover detailed information about the templates in a coming slide, but for now you can get an idea of how they are structured.
  8. At this point you’d want to prepare your template values.  However, as I mentioned above I’m going to save the details of altering the template values for another post since it really deserves a thorough explanation. 
  9. Now let’s add in the Starbucks data.  Open the “Starbucks No Linefeeds” Excel spreadsheet which contains the latitude,longitude, identification, and address values for each Starbucks location.  Due to the large size of the file I’m only going to add in Starbucks locations for my city, San Antonio.  Go to the PlacemarkData link at the bottom of the spreadsheet.
    • The Folder Name is optional, but in this case we’re going to define the folder name as “Starbucks” for each placemark instance.  What this will do is group the placemarks under the same Folder in Google Earth.  This would be helpful if you’d like to group Starbucks locations by city (i.e. San Antonio, Dallas, Houston, Austin). 
    • For the Placemark Name column I’m going to add in the unique identifier for each location based on the information pulled from the Excel spreadsheet we downloaded.  You should be able to copy and paste the data from MS Excel to the Google Docs spreadsheet to save time.
    • We’ll also enter the latitude, longitude values for each Starbucks location, also pulled from the Excel spreadsheet we downloaded.  If you don’t have coordinate values for each placemark you can enter an address which can be used to generate the placemark. 
    • Finally, we specify a template (#5 in this case) to define our icon and balloon styles.  The spreadsheet should look something like you see below.
  10.  Click Publish –> Re-publish document in your Google Docs spreadsheet.  Then refresh your network link in Google Earth by right clicking on “Link to - Spreadsheet” in the Places panel and selecting Refresh.  This should refresh the Google Earth display with the new Starbucks locations we entered in the Google Docs spreadsheet.
 
In our next post we’ll cover the templates provides by Spreadsheet Mapper and also take a look at how you can create your own templates.
March Sale on Google Earth and Google Maps E-Learning Courses
During the month of March we are offering a 15% discount on our “Google Earth and Google Maps Bundle” e-learning set.  Sale price is $170.00 (e-delivery), $210.00 (mail delivery).  This bundle is composed of 5 e-learning courses with over 450 pages of instruction.  Courses include:

Posted in Google Earth, Google Maps, Network Links | 2 Comments »

GeoSpatial Training Services - March 2008 Update

Posted by epimpler on March 3, 2008

GIS Programming 101 Course
Our GIS Programming 101 course scheduled for March 24th - April 18th is almost full.  We still have one seat available so if you’re interested please let us know ASAP.  Because the demand for this course has been so high we will be offering a second section of this course in the May-June timeframe.  The exact timing of the course has not been determined as of yet, but we will let everyone know as soon as we have the dates. 

This is an instructor guided course taught in a Virtual GIS Classroom using the same technologies implemented by colleges and universities around the world to deliver Internet based courses. Our new Virtual GIS Classroom blends the best of instructor led and e-learning formats into a new instructor led web based format that allows for more interactivity between the instructor and student, and between students.

GIS Programming 101: Mastering Python for Geoprocessing in ArcGIS is designed to teach the fundamental programming constructs of the Python language and how it can be integrated with ArcGIS Desktop to automate geoprocessing tasks.  Course participants will be led through a series of 13 modules described below.
Module 1:  Getting Started with Python in ArcGIS
Module 2:  The Geoprocessor ArcObject
Module 3:  Basic Python Language Features
Module 4:  Obtaining Descriptive Information About ArcGIS Data
Module 5: Using Cursor Objects to Select, Edit, and Add Records to Tables and Feature Classes
Module 6:  Enumeration Objects for Listing ArcGIS Data
Module 7:  Miscellaneous Objects
Module 8:  Dynamic Scripts
Module 9:  Integrating Python Scripts with ArcToolbox
Module 10:  Geoprocessing Tools
Module 11: Scheduling Geoprocessing Tasks
Module 12:  Messaging and Error Handling
Module 13:  Final Project

March Sale on Google Earth and Google Maps E-Learning Courses
During the month of March we are offering a 15% discount on our “Google Maps and Google Earth Bundle“.  Regular price is $200.00 (e-delivery), $250.00 (mail delivery), but during the month of March you can purchase this bundle for $170.00 (e-delivery), $210.00 (mail delivery). This bundle is composed of 5 e-learning courses with over 450 pages of instruction.  The five courses are as follows:

Mastering KML in Google Earth
Google Earth for ArcGIS Users
Google Maps for Your Apps!
Arc2Earth for ArcGIS Users
Dynamic Google Earth Applications (in development scheduled for March release)

See more information on these courses.

As always we offer an additional 15% discount on any course to all educational, non-profit, local, state, and federal government organizations.  Please contact sales at geospatialtraining.com to take advantage of this discount.

Posted in ESRI, GeoSpatial Training Services, Geoprocessing, Google Earth, Google Maps | No Comments »