demos/main.js
function getFeaturePropsHTML (feature) {
        var props = ['name', 'kind', 'kind_detail', 'id']; // show these properties first if available
        Object.keys(feature.properties) // show rest of proeprties alphabetized
            .sort()
            .forEach(function(p) {
                if (props.indexOf(p) === -1) {
                    props.push(p);
                }
            });

        var info = '<div class="featureTable">';
        props.forEach(function(p) {
            if (feature.properties[p]) {
                info += '<div class="featureRow"><div class="featureCell"><b>' + p + '</b></div>' +
                    '<div class="featureCell">' + feature.properties[p] + '</div></div>';
            }
        });
        info += '<div class="featureRow"><div class="featureCell"><b>scene layers</b></div>' +
                '<div class="featureCell">' + feature.layers.join('<br>') + '</div></div>';
        info += '</div>';
        return info;
    }
function getFeaturePropsHTML (feature) {
        var props = ['name', 'kind', 'kind_detail', 'id']; // show these properties first if available
        Object.keys(feature.properties) // show rest of proeprties alphabetized
            .sort()
            .forEach(function(p) {
                if (props.indexOf(p) === -1) {
                    props.push(p);
                }
            });

        var info = '<div class="featureTable">';
        props.forEach(function(p) {
            if (feature.properties[p]) {
                info += '<div class="featureRow"><div class="featureCell"><b>' + p + '</b></div>' +
                    '<div class="featureCell">' + feature.properties[p] + '</div></div>';
            }
        });
        info += '<div class="featureRow"><div class="featureCell"><b>scene layers</b></div>' +
                '<div class="featureCell">' + feature.layers.join('<br>') + '</div></div>';
        info += '</div>';
        return info;
    }
function getFeaturePropsHTML ( feature ) { var props = [ 'name' , 'kind' , 'kind_detail' , 'id' ] ; // show these properties first if available Object . keys ( feature . properties ) // show rest of proeprties alphabetized . sort ( ) . forEach ( function ( p ) { if ( props . indexOf ( p ) === - 1 ) { props . push ( p ) ; } } ) ; var info = '<div class="featureTable">' ; props . forEach ( function ( p ) { if ( feature . properties [ p ] ) { info += '<div class="featureRow"><div class="featureCell"><b>' + p + '</b></div>' + '<div class="featureCell">' + feature . properties [ p ] + '</div></div>' ; } } ) ; info += '<div class="featureRow"><div class="featureCell"><b>scene layers</b></div>' + '<div class="featureCell">' + feature . layers . join ( '<br>' ) + '</div></div>' ; info += '</div>' ; return info ; }
Get an HTML fragment with feature properties
Get an HTML fragment with feature properties