<!--
osgEarth Sample.

Demonstrates the use of a Resource Library in order to apply "typical" textures
to extruded buildings.
-->

<map name="Boston Demo">
    
    <TMSImage name="Imagery">
        <url>https://readymap.org/readymap/tiles/1.0.0/22/</url>
    </TMSImage>
    
    <xi:include href="readymap_elevation.xml"/>
      
    <TiledFeatureModel name="Buildings" pickable="true">

        <OGRFeatures name="buildings-data">
            <url>../data/boston_buildings_utm19.shp</url>
            <filters>
                <resample min_length="2.5"/>
            </filters>
        </OGRFeatures>

        <min_level>3</min_level>
        
        <styles>
            <library name="us_resources">
                <url>../data/resources/textures_us/catalog.xml</url>
            </library>
            
            <style type="text/css">
                buildings {
                    extrusion-height: 3.5 * Math.max(feature.properties.story_ht_, 1);
                    extrusion-flatten: true;
                    extrusion-wall-style: building-wall;
                    extrusion-wall-gradient: 0.5;
                    extrusion-roof-style: building-rooftop;
                    altitude-clamping: terrain;
                    altitude-technique: map;
                    altitude-binding: vertex;
                }            
                building-wall {
                    skin-library: us_resources;
                    skin-tags: building;
                    skin-random-seed: 1;
                }
                building-rooftop {
                    skin-library: us_resources;
                    skin-tags: rooftop;
                    skin-tiled: true;
                    skin-random-seed: 1;
                }
            </style>
        </styles>   
    </TiledFeatureModel>    
    
    <TiledFeatureModel name="Streets">
        <OGRFeatures name="streets-data">
            <url>../data/boston-scl-utm19n-meters.shp</url>
            <filters>
                <resample min_length="25" max_length="25"/>
            </filters>
        </OGRFeatures>
        <min_level>3</min_level>
        <styles>
            <style type="text/css">
                default {
                    stroke: #131313;
                    stroke-width: 7.5m;
                    stroke-linejoin: round;
                    stroke-linecap: round;
                    altitude-clamping: terrain;
                    render-depth-offset: 10m;
                    x-render-depth-offset-min-bias: 3.6;
                    render-transparent: true;
                }
            </style>
        </styles>        
    </TiledFeatureModel>
	    
    <TiledFeatureModel name="Parks" enabled="true">
        <OGRFeatures name="parks">
            <url>../data/boston-parks.shp</url>
        </OGRFeatures>    
        <min_level>3</min_level>    
        
        <feature_indexing enabled="false"/>
        
        <styles>
            <style type="text/css">
                default {
                   model: "../data/loopix/tree4.osgb";
				   model-scale: 0.15 + 0.1*Math.random();
                   model-placement: random;
                   model-density: 3000;
				   model-heading: Math.random() * 360.0;
                   altitude-clamping: terrain;
                   render-transparent: true;
				   render-min-alpha: 0.15;
                }
            </style>
        </styles>        
    </TiledFeatureModel>
    
    <viewpoints time="1.0" home="0">
        <viewpoint name="Boston Overview" heading="24.261" height="0" lat="42.34425" long="-71.076262" pitch="-21.6" range="3450"/>
        <viewpoint name="Boston Downtown 0" heading="26.3875" range="240m" lat="42.35727" long="-71.064521" pitch="-13.5" height="0"/>
        <viewpoint name="Boston Downtown 1" heading="117" lat="42.3568" long="-71.0585" height="0" pitch="-20.4" range="1500" />
        <viewpoint name="Boston Downtown 2" heading="-128.5" lat="42.3582" long="-71.0546" height="0" pitch="-19" range="1620" />
        <viewpoint name="Boston Street Level" heading="-145.64081" lat="42.364015" long="-71.054149" pitch="-9.701" range="144.95"/>
    </viewpoints>

</map>
