(zoom: int, lat: float, lng: float, source_crs: str, scheme="xyz")
return int(col), int(row)
* Returns the tile-xy from the specified WGS84 lat/long coordinates
    :param scheme: The tile scheme for which the tile coordinates shall be returned
    :param source_crs: The CRS in which lat/lon are represented
    :param zoom:
    :param lat:
    :param lng:
    :return:
* Returns the tile-xy from the specified WGS84 lat/long coordinates
    :param scheme: The tile scheme for which the tile coordinates shall be returned
    :param source_crs: The CRS in which lat/lon are represented
    :param zoom:
    :param lat:
    :param lng:
    :return:
* Returns the tile - xy from the specified WGS84 lat / long coordinates : param scheme : The tile scheme for which the tile coordinates shall be returned : param source_crs : The CRS in which lat / lon are represented : param zoom : : param lat : : param lng : : return :
def latlon_to_tile(zoom: int, lat: float, lng: float, source_crs: str, scheme="xyz") -> Tuple[int, int]:
    """
     * Returns the tile-xy from the specified WGS84 lat/long coordinates
    :param scheme: The tile scheme for which the tile coordinates shall be returned
    :param source_crs: The CRS in which lat/lon are represented
    :param zoom:
    :param lat:
    :param lng:
    :return:
    """
    if zoom is None:
        raise RuntimeError("zoom is required")
    if lat is None:
        raise RuntimeError("latitude is required")
    if lng is None:
        raise RuntimeError("Longitude is required")

    if get_code_from_epsg(source_crs) != 3857:
        lng, lat = convert_coordinate(source_crs=source_crs, target_crs="epsg:3857", lat=lat, lng=lng)
    gm = GlobalMercator(tileSize=512)
    global_mercator_output_scheme = "tms"
    col, row = gm.MetersToTile(mx=lng, my=lat, zoom=zoom)  # GlobalMercator returns in TMS scheme here
    col = clamp(col, low=0)
    row = clamp(row, low=0)
    if scheme != global_mercator_output_scheme:
        row = clamp(change_scheme(zoom, row), low=0)

    return int(col), int(row)
def latlon_to_tile ( zoom : int , lat : float , lng : float , source_crs : str , scheme = "xyz" ) -> Tuple [ int , int ] : if zoom is None : raise RuntimeError ( "zoom is required" ) if lat is None : raise RuntimeError ( "latitude is required" ) if lng is None : raise RuntimeError ( "Longitude is required" ) if get_code_from_epsg ( source_crs ) != 3857 : lng , lat = convert_coordinate ( source_crs = source_crs , target_crs = "epsg:3857" , lat = lat , lng = lng ) gm = GlobalMercator ( tileSize = 512 ) global_mercator_output_scheme = "tms" col , row = gm . MetersToTile ( mx = lng , my = lat , zoom = zoom ) # GlobalMercator returns in TMS scheme here col = clamp ( col , low = 0 ) row = clamp ( row , low = 0 ) if scheme != global_mercator_output_scheme : row = clamp ( change_scheme ( zoom , row ) , low = 0 ) return int ( col ) , int ( row )