Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
 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