コード例 #1
0
        if len(date_values) == 1:
            properties['end_date'] = date_values[0]
        elif len(date_values) == 2 and date_values[1] != '-':
            properties['end_date'] = date_values[1]

    if imagery.getAttribute('overlay') == "true":
        properties['overlay'] = True

    if imagery.getAttribute('eli-best') == "true":
        properties['best'] = True

    country_code_node = imagery.getElementsByTagName('country-code')
    if country_code_node:
        properties['country_code'] = country_code_node[0].childNodes[0].nodeValue

    projs = util.getprojs(imagery)
    if projs: properties['available_projections'] = projs

    attr_text = None
    attr_required = None
    attr_url = None

    attr_text_node = imagery.getElementsByTagName('attribution-text')
    if attr_text_node:
        attr_text = attr_text_node[0].childNodes[0].nodeValue
        attr_required = bool(attr_text_node[0].getAttribute('mandatory'))

    attr_url_node = imagery.getElementsByTagName('attribution-url')
    if attr_url_node:
        attr_url = attr_url_node[0].childNodes[0].nodeValue
コード例 #2
0
ファイル: convert_geojson.py プロジェクト: vince0508/id_test
for imagery in imageries:
    entry = {
        "type": "Feature",
        "properties": {}
    }

    entry['properties']['name'] = imagery.getElementsByTagName('name')[0].childNodes[0].nodeValue
    entry['properties']['type'] = imagery.getElementsByTagName('type')[0].childNodes[0].nodeValue
    entry['properties']['url']  = imagery.getElementsByTagName('url')[0].childNodes[0].nodeValue
    if imagery.getElementsByTagName('country-code'):
        entry['properties']['country-code'] = imagery.getElementsByTagName('country-code')[0].childNodes[0].nodeValue
    if imagery.getElementsByTagName('best'):
        entry['properties']['best'] = True

    projs = util.getprojs(imagery)
    if projs: entry['properties']['available_projections'] = projs

    attr_text = None
    attr_required = None
    attr_url = None

    attr_text_node = imagery.getElementsByTagName('attribution-text')
    if attr_text_node:
        attr_text = attr_text_node[0].childNodes[0].nodeValue
        attr_required = bool(attr_text_node[0].getAttribute('mandatory'))

    attr_url_node = imagery.getElementsByTagName('attribution-url')
    if attr_url_node:
        attr_url = attr_url_node[0].childNodes[0].nodeValue