def geom_length(geom):
    """
    Calculates the length of coordinates in a shapely geometry.
    """
    if geom.geom_type == 'Point':
        return 1
    if hasattr(geom, 'exterior'):
        geom = geom.exterior
    if not geom.geom_type.startswith('Multi') and hasattr(geom, 'array_interface_base'):
        return len(geom.array_interface_base['data'])//2
    else:
        length = 0
        for g in geom:
            length += geom_length(g)
        return length
Calculates the length of coordinates in a shapely geometry.