[gdal-dev] Reading S57 Extents from Python

Mike Slinn mslinn at mslinn.com
Thu Apr 17 11:50:46 EDT 2008


Hmm, looks like the ordering of the coordinate components isn't what I 
had expected.  This is a correction and further optimization to my 
previous posting.  Apologies for the flurry of postings:

def degreesNS(deg):
	"""Formats degrees and decimal minutes of latitude"""
	return degreesFormatter(deg, "N", "S")

def degreesEW(deg):
	"""Formats degrees and decimal minutes of longitude"""
	return degreesFormatter(deg, "E", "W")

def degreesFormatter(deg, hemiPos, hemiNeg):
	"""Formats degrees and decimal minutes"""
	adeg = deg
	hemi = hemiPos
	if deg<0:
		hemi = hemiNeg
		adeg = -deg
	return "%d%c%.3f'%s" % (int(adeg), u'\N{DEGREE SIGN}', (adeg%1)*60, hemi)

extentStr = "      Extents: (%s, %s) to (%s, %s)" % \
            (degreesNS(extents[2]), degreesEW(extents[0]), degreesNS(extents[3]), degreesEW(extents[1]))

Hopefully someone can shed some light on how to access the S-57 
Catalogue directory field.

Mike


More information about the gdal-dev mailing list