Friday, February 25, 2011

Getting a File Extension

Here is a useful bit of code to get the file extension of a file. The os module has a useful built in function called splitext(), which returns a string array where the 2nd entry is the file extension.

From Python.org:
Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and contains at most one period. Leading periods on the basename are ignored; splitext('.cshrc') returns ('.cshrc', '').

Enjoy
~A


def __fileExtension(filePath):
import os
return os.path.splitext(filePath)[1]

Wednesday, February 2, 2011

Map Scale and Resolution

When I first started using GIS, I did not program and I did not write any custom code.  I was a cartographer many years ago.  As I move on in my career I have slowly moved away from cartography, but the principles I learned in my cartography classes have been critical to my success as a developer.  When I saw this blog post it brought back a time when I use to just be a map maker (cartographer).  If you program in the GIS world, no matter if it's web, desktop, or services, you should always have a good understanding of how to present data.  Developing tools to show and analyze data is just one part of GIS, but in reality it's how you interpret/display the results that really matter.

So read up on this article because understanding Map Scale and Resolution is important to being a good GIS programmer.

I shall step off the soapbox now.