def getMGRS(self, precision=10): ''' Converts the geos to MGRS. The optional precision determines the number of figures for the MGRS conversion. Tests written.''' utm = Geographic.geo2Utm(self.lat, self.lon) mgrs = Geographic.utm2Mgrs(utm[0], utm[1], utm[2], precision) return mgrs
def testGeo2Mgrs(self): ''' ''' lat = 45.5 lon = 34.4 #retrieve UTM zone, easting, northing = Geographic.geo2Utm(lat, lon) mgrs = Geographic.utm2Mgrs(zone, easting, northing, d=10) print "10 fig", mgrs mgrs = Geographic.utm2Mgrs(zone, easting, northing, d=8) print "8 fig", mgrs mgrs = Geographic.utm2Mgrs(zone, easting, northing, d=6) print "6 fig", mgrs mgrs = Geographic.utm2Mgrs(zone, easting, northing, d=4) print "4 fig", mgrs mgrs = Geographic.utm2Mgrs(zone, easting, northing, d=2) print "2 fig", mgrs