Esempio n. 1
0
def getLayerName(url):
    """Extract the layer name from a url.

    Args:
        url (str): The url to parse.

    Returns:
        str: The layer name.

    Examples:
        >>> url = "http://services.arcgis.com/<random>/arcgis/rest/services/test/FeatureServer/12"
        >>> arcresthelper.common.getLayerIndex(url)
        'test'

    """
    urlInfo = None
    urlSplit = None
    try:
        urlInfo = urlparse.urlparse(url)
        urlSplit = str(urlInfo.path).split('/')
        name = urlSplit[len(urlSplit)-3]
        return name
    except:
        return url

    finally:
        urlInfo = None
        urlSplit = None

        del urlInfo
        del urlSplit

        gc.collect()
def getLayerName(url):
    """Extract the layer name from a url.

    Args:
        url (str): The url to parse.

    Returns:
        str: The layer name.

    Examples:
        >>> url = "http://services.arcgis.com/<random>/arcgis/rest/services/test/FeatureServer/12"
        >>> arcresthelper.common.getLayerIndex(url)
        'test'

    """
    urlInfo = None
    urlSplit = None
    try:
        urlInfo = urlparse.urlparse(url)
        urlSplit = str(urlInfo.path).split('/')
        name = urlSplit[len(urlSplit) - 3]
        return name
    except:
        return url

    finally:
        urlInfo = None
        urlSplit = None

        del urlInfo
        del urlSplit

        gc.collect()
Esempio n. 3
0
def getLayerName(url):
    urlInfo = None
    urlSplit = None
    try:
        urlInfo = urlparse.urlparse(url)
        urlSplit = str(urlInfo.path).split('/')
        name = urlSplit[len(urlSplit)-3]
        return name
    except:
        return url

    finally:
        urlInfo = None
        urlSplit = None

        del urlInfo
        del urlSplit

        gc.collect()
Esempio n. 4
0
def getLayerIndex(url):
    urlInfo = None
    urlSplit = None
    inx = None
    try:
        urlInfo = urlparse.urlparse(url)
        urlSplit = str(urlInfo.path).split('/')
        inx = urlSplit[len(urlSplit)-1]

        if is_number(inx):
            return int(inx)

    except:
        return 0
    finally:
        urlInfo = None
        urlSplit = None

        del urlInfo
        del urlSplit

        gc.collect()
Esempio n. 5
0
def getLayerIndex(url):
    """Extract the layer index from a url.

    Args:
        url (str): The url to parse.

    Returns:
        int: The layer index.

    Examples:
        >>> url = "http://services.arcgis.com/<random>/arcgis/rest/services/test/FeatureServer/12"
        >>> arcresthelper.common.getLayerIndex(url)
        12

    """
    urlInfo = None
    urlSplit = None
    inx = None
    try:
        urlInfo = urlparse.urlparse(url)
        urlSplit = str(urlInfo.path).split('/')
        inx = urlSplit[len(urlSplit)-1]

        if is_number(inx):
            return int(inx)

    except:
        return 0
    finally:
        urlInfo = None
        urlSplit = None

        del urlInfo
        del urlSplit

        gc.collect()
def getLayerIndex(url):
    """Extract the layer index from a url.

    Args:
        url (str): The url to parse.

    Returns:
        int: The layer index.

    Examples:
        >>> url = "http://services.arcgis.com/<random>/arcgis/rest/services/test/FeatureServer/12"
        >>> arcresthelper.common.getLayerIndex(url)
        12

    """
    urlInfo = None
    urlSplit = None
    inx = None
    try:
        urlInfo = urlparse.urlparse(url)
        urlSplit = str(urlInfo.path).split('/')
        inx = urlSplit[len(urlSplit) - 1]

        if is_number(inx):
            return int(inx)

    except:
        return 0
    finally:
        urlInfo = None
        urlSplit = None

        del urlInfo
        del urlSplit

        gc.collect()