def initGlobalsFromFile(filename): """ At this stage we are defaulting the filename to sys.argv[1], but this should really be done with getopt """ shpfile = shapelibc.open(str(sys.argv[1]),"rb") minbounds = shapelibc.ShapeFile_info(shpfile)[2] maxbounds = shapelibc.ShapeFile_info(shpfile)[2] dbffile = dbflibc.open(str(sys.argv[1]),"rb") numrecords = dbflibc.DBFFile_record_count(dbffile) numfields = dbflibc.DBFFile_field_count(dbffile) return
def initGlobalsFromFile(filename): """ At this stage we are defaulting the filename to sys.argv[1], but this should really be done with getopt """ shpfile = shapelibc.open(str(sys.argv[1]), "rb") minbounds = shapelibc.ShapeFile_info(shpfile)[2] maxbounds = shapelibc.ShapeFile_info(shpfile)[2] dbffile = dbflibc.open(str(sys.argv[1]), "rb") numrecords = dbflibc.DBFFile_record_count(dbffile) numfields = dbflibc.DBFFile_field_count(dbffile) return
#if no outputfile was specced, give it a name outputfile = inputfile + ".kml" #see if we can open it try: shpfile = shapelibc.open(inputfile,"rb") except IOError,err: #if we cannot open the shpfile we should die print str(err) sys.exit(2) #we got this far, now try the dbf try: dbffile = dbflibc.open(inputfile,"rb") except IOError,err: print """You did not supply a dbf file, all objects of the same type will be considered equal.""" nodbf = True def parseConfigFile(filename): global x_offset # shapefile x offset relative to earth coords global y_offset # shapefile y offset relative to earth coords global z_offset # shapefile z offset relative to earth coords global x_scale # shapefile x scale to get to proper earth coords global y_scale # shapefile y scale to get to proper earth coords global z_scale # shapefile z scale to get to proper earth coords global feattype # field num for differentiating different styles global featname # field num for differentiating different styles
#if no outputfile was specced, give it a name outputfile = inputfile + ".kml" #see if we can open it try: shpfile = shapelibc.open(inputfile, "rb") except IOError, err: #if we cannot open the shpfile we should die print str(err) sys.exit(2) #we got this far, now try the dbf try: dbffile = dbflibc.open(inputfile, "rb") except IOError, err: print """You did not supply a dbf file, all objects of the same type will be considered equal.""" nodbf = True def parseConfigFile(filename): global x_offset # shapefile x offset relative to earth coords global y_offset # shapefile y offset relative to earth coords global z_offset # shapefile z offset relative to earth coords global x_scale # shapefile x scale to get to proper earth coords global y_scale # shapefile y scale to get to proper earth coords global z_scale # shapefile z scale to get to proper earth coords global feattype # field num for differentiating different styles global featname # field num for differentiating different styles