owslib/feature/schema.py
def _construct_schema(elements, nsmap):
    """Consruct fiona schema based on given elements

    :param list Element: list of elements
    :param dict nsmap: namespace map

    :return dict: schema
    """

    schema = {
        'properties': {},
        'geometry': None
    }

    schema_key = None
    gml_key = None

    # if nsmap is defined, use it
    if nsmap:
        for key in nsmap:
            if nsmap[key] == XS_NAMESPACE:
                schema_key = key
            if nsmap[key] in GML_NAMESPACES:
                gml_key = key
    # if no nsmap is defined, we have to guess
    else:
        gml_key = 'gml'
        schema_key = 'xsd'

    mappings = {
        'PointPropertyType': 'Point',
        'PolygonPropertyType': 'Polygon',
        'LineStringPropertyType': 'LineString',
        'MultiPointPropertyType': 'MultiPoint',
        'MultiLineStringPropertyType': 'MultiLineString',
        'MultiPolygonPropertyType': 'MultiPolygon',
        'MultiGeometryPropertyType': 'MultiGeometry',
        'GeometryPropertyType': 'GeometryCollection',
        'SurfacePropertyType': '3D Polygon',
        'MultiSurfacePropertyType': '3D MultiPolygon'
    }

    for element in elements:
        data_type = element.attrib['type'].replace(gml_key + ':', '')
        name = element.attrib['name']

        if data_type in mappings:
            schema['geometry'] = mappings[data_type]
            schema['geometry_column'] = name
        else:
            schema['properties'][name] = data_type.replace(schema_key+':', '')

    if schema['properties'] or schema['geometry']:
        return schema
    else:
        return None
def _construct_schema(elements, nsmap):
    schema = {
        'properties': {},
        'geometry': None
    }

    schema_key = None
    gml_key = None

    # if nsmap is defined, use it
    if nsmap:
        for key in nsmap:
            if nsmap[key] == XS_NAMESPACE:
                schema_key = key
            if nsmap[key] in GML_NAMESPACES:
                gml_key = key
    # if no nsmap is defined, we have to guess
    else:
        gml_key = 'gml'
        schema_key = 'xsd'

    mappings = {
        'PointPropertyType': 'Point',
        'PolygonPropertyType': 'Polygon',
        'LineStringPropertyType': 'LineString',
        'MultiPointPropertyType': 'MultiPoint',
        'MultiLineStringPropertyType': 'MultiLineString',
        'MultiPolygonPropertyType': 'MultiPolygon',
        'MultiGeometryPropertyType': 'MultiGeometry',
        'GeometryPropertyType': 'GeometryCollection',
        'SurfacePropertyType': '3D Polygon',
        'MultiSurfacePropertyType': '3D MultiPolygon'
    }

    for element in elements:
        data_type = element.attrib['type'].replace(gml_key + ':', '')
        name = element.attrib['name']

        if data_type in mappings:
            schema['geometry'] = mappings[data_type]
            schema['geometry_column'] = name
        else:
            schema['properties'][name] = data_type.replace(schema_key+':', '')

    if schema['properties'] or schema['geometry']:
        return schema
    else:
        return None
def _construct_schema ( elements , nsmap ) : schema = { 'properties' : { } , 'geometry' : None } schema_key = None gml_key = None # if nsmap is defined, use it if nsmap : for key in nsmap : if nsmap [ key ] == XS_NAMESPACE : schema_key = key if nsmap [ key ] in GML_NAMESPACES : gml_key = key # if no nsmap is defined, we have to guess else : gml_key = 'gml' schema_key = 'xsd' mappings = { 'PointPropertyType' : 'Point' , 'PolygonPropertyType' : 'Polygon' , 'LineStringPropertyType' : 'LineString' , 'MultiPointPropertyType' : 'MultiPoint' , 'MultiLineStringPropertyType' : 'MultiLineString' , 'MultiPolygonPropertyType' : 'MultiPolygon' , 'MultiGeometryPropertyType' : 'MultiGeometry' , 'GeometryPropertyType' : 'GeometryCollection' , 'SurfacePropertyType' : '3D Polygon' , 'MultiSurfacePropertyType' : '3D MultiPolygon' } for element in elements : data_type = element . attrib [ 'type' ] . replace ( gml_key + ':' , '' ) name = element . attrib [ 'name' ] if data_type in mappings : schema [ 'geometry' ] = mappings [ data_type ] schema [ 'geometry_column' ] = name else : schema [ 'properties' ] [ name ] = data_type . replace ( schema_key + ':' , '' ) if schema [ 'properties' ] or schema [ 'geometry' ] : return schema else : return None
Consruct fiona schema based on given elements

    :param list Element: list of elements
    :param dict nsmap: namespace map

    :return dict: schema
Consruct fiona schema based on given elements