<!--
osgEarth Sample - ReadyMap.ORG Server - https://readymap.org

ReadyMap.ORG provides free global base map data for osgEarth developers!
This tiled, worldwide dataset of imagery, elevation, and street map data
is a great base map that provides global context for your own local datasets.
It works "out of the box" with osgEarth applications.

**** NOTICE ****
YOU ARE RESPONSIBLE for abiding by the TERMS AND CONDITIONS outlined at:
https://readymap.org

-->
<Map name="Roads Test">

    <options>
        <terrain skirt_ratio="0.005" gpu_tessellation="false"/>
    </options>
        
    <TMSImage name="readymap_imagery" driver="tms" visible="true" opacity="0.8">
        <url>https://readymap.org/readymap/tiles/1.0.0/7/</url>
    </TMSImage>
    
    <xi:include href="readymap_elevation.xml"/>

    <DebugImage name="TileKey debug" open="false"/>

    <TiledFeatureModel name="Road center-line" open="true">
        <profile>spherical-mercator</profile>
        <features>roads-data</features>
        <styles>
            <style type="text/css">
                default {
                    stroke: #00ffff7f;
                    stroke-width: 8m;
                    stroke-linejoin: miter;
                    stroke-linecap: flat;
                    render-depth-offset: 25m;
                    altitude-clamping: terrain;
                }
            </style>
        </styles>
    </TiledFeatureModel>

    <TiledFeatureModel name="Road center-line verts">
        <profile>spherical-mercator</profile>
        <features>roads-data</features>
        <styles>
            <style type="text/css">
                default {
                    point-fill: #00ffff;
                    point-size: 12;
                    point-smooth: true;
                    stroke: #ffff00;
                    stroke-width: 2px;
                    render-order: 1;
                    render-depth-offset: 1m;
                    altitude-clamping: terrain;
                }
            </style>
        </styles>
    </TiledFeatureModel>

    <TiledFeatureModel name="Road surface - mesh" open="false">
        <profile>spherical-mercator</profile>
        <features>roads-data</features>
        <styles>
            <style type="text/css">
                default {
                    stroke: #ffffff;
                    stroke-width: 8m;
                    stroke-linejoin: miter;
                    stroke-linecap: flat;
                    stroke-image: "'../data/road.png'";
                    render-depth-offset: true;
                    altitude-clamping: terrain;
                }
            </style>
        </styles>
    </TiledFeatureModel>

    <RoadSurface name="Road surface - rasterized" min_level="14" max_data_level="18" open="true">
        <cache_policy usage="no_cache"/>
        <tile_size>512</tile_size>
        <features>roads-data-local</features>
        <styles>
            <style type="text/css">
                default {
                   stroke: #ffffff;
                   stroke-width: 8m;
                   stroke-image: "'../data/road.png'";
                }
            </style>
        </styles>
    </RoadSurface>

    <MVTFeatures name="roads-data-local">
        <url>E:/osm.mbtiles</url>
        <min_level>14</min_level>
        <max_level>14</max_level>
        <profile>spherical-mercator</profile>
        <format>pbf</format>
        <filters>
            <attributes>highway</attributes>
        </filters>
    </MVTFeatures>

    <XYZFeatures name="roads-data">
        <url>https://readymap.org/readymap/mbtiles/osm/{z}/{x}/{-y}.pbf</url>
        <min_level>14</min_level>
        <max_level>14</max_level>
        <profile>spherical-mercator</profile>
        <format>pbf</format>
        <filters>
            <script language="javascript">
                <![CDATA[ ("highway" in feature.properties) ]]>
            </script>
            <resample max_length="10"/>
        </filters>
    </XYZFeatures>
    
    <TerrainConstraint name="Road Constraints" open="false">
        <min_level>16</min_level>
        <model>Road surface - mesh</model>
        <has_elevation>true</has_elevation>
        <remove_interior>true</remove_interior>
    </TerrainConstraint>
    
    <FlattenedElevation name="Road flattening" min_level="14" max_data_level="14">
        <features>roads-data</features>
        <line_width>8.0</line_width>
        <buffer_width>20.0</buffer_width>
    </FlattenedElevation>

    <viewpoints>
        <viewpoint name="45 Lat">
            <heading>-27.1632</heading>
            <pitch>-27.8402</pitch>
            <range>266.039m</range>
            <long>-121.6349038968369</long>
            <lat>46.76597267039175</lat>
            <height>921.1276175510138</height>
            <srs>+proj=longlat +datum=WGS84 +no_defs</srs>
        </viewpoint>
        <viewpoint name="Equator">
            <heading>-2.31914e-008</heading>
            <pitch>-89.0007</pitch>
            <range>3664.39m</range>
            <long>-80.08167477509062</long>
            <lat>-0.001110080780562921</lat>
            <height>-3.306940197944641e-005</height>
            <srs>+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs </srs>
        </viewpoint>
        <viewpoint name="Nawlins">
            <heading>2.26704e-07</heading>
            <pitch>-89</pitch>
            <range>7627.42m</range>
            <long>-90.06802181788174</long>
            <lat>29.95108448386778</lat>
            <height>-0.0001322757452726364</height>
            <srs>+proj=longlat +datum=WGS84 +no_defs</srs>
        </viewpoint>
    </viewpoints>
</Map>
