pythonutm

Zone to use to convert UK utm data to longitude, and latitude


I'm currently working on a UK vehicle accident dataframe and I'd like to convert easting and northing utm data to longitude and latitude, and then into regions. I am unsure about which zone to use in the function despite searching the internet.

My current function works but I'm unsure about the zones and further creating a column converting longitude and latitude into regions.

Curent Function:

def rule(row):
    lat, lon = utm.to_latlon(row["location_easting_osgr"], row["location_northing_osgr"], 30, 'U')
    return pd.Series({"lat": lat, "long": lon})
df = df.merge(df_subset.apply(rule, axis=1), left_index= True, right_index= True)

Solution

  • Wikipedia has all the zone information in this image: (https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system#/media/File:Universal_Transverse_Mercator_zones.svg)

    Most of the UK is in zone 30U. So it looks like you have it right.

    Alternatively you could just use the longitudinal zone and the hemisphere:

    lat, lon = utm.to_latlon(row["location_easting_osgr"], row["location_northing_osgr"], 30, northern=FALSE)