def getXYCoords(geometry, coord_type):
    """
    Returns either x or y coordinates from  geometry coordinate sequence.
    Used with LineString and Polygon geometries.
    """
    if coord_type == 'x':
        return geometry.coords.xy[0]
    elif coord_type == 'y':
        return geometry.coords.xy[1]