def convert(row): e = row["easting"] n = row["northing"] lon, lat = osgb_to_lonlat(eastnorth_to_osgb(e, n, digits=4)) row["latitude"] = lat row["longitude"] = lon return row
def met2latlon(east, north, verbose=False): """ Convert nasty numbers using osgb as a back-end Input location east and north from the OSGR corner and return the lat, lon (in degrees). """ gridref = osgb.eastnorth_to_osgb(east * 100, north * 100) if verbose: print "Grid reference: " + gridref lon, lat = osgb.osgb_to_lonlat(gridref) return lat, lon
def met2latlon(east, north, verbose=False): """ Convert nasty numbers using osgb as a back-end Input location east and north from the OSGR corner and return the lat, lon (in degrees). """ gridref = osgb.eastnorth_to_osgb(east*100, north*100) if verbose: print "Grid reference: " + gridref lon, lat = osgb.osgb_to_lonlat(gridref) return lat, lon
def convert_os_to_coords(oscode): lon, lat = osgb.osgb_to_lonlat(oscode) value_string = "ST_GeomFromText('POINT(" + str(lon) + " " + str(lat) + ")',4326)" return value_string
def osgb_to_wgs84(self, ngr): lon, lat = osgb.osgb_to_lonlat(ngr) return "SRID=4326;POINT({0} {1})".format(lon, lat)
def testOSGB(self): lon, lat = osgb.osgb_to_lonlat('SX586920') print lat,lon