gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.51k stars 779 forks source link

Extruded buildings doesn't work correct with elevation (master/win64) #550

Closed remoe closed 9 years ago

remoe commented 10 years ago

You can reproduce it with running "osgearth_toc.exe" with the following earth file on stock sample:

<map name="readymap.org" type="geocentric" version="2">

    <options>
        <elevation_tile_size>7</elevation_tile_size>
        <terrain first_lod="1"/>
    </options>

    <image name="readymap_imagery" driver="tms" visible="true">
        <url>http://readymap.org/readymap/tiles/1.0.0/7/</url>
    </image>

    <elevation name="readymap_elevation" driver="tms">
        <url>http://readymap.org/readymap/tiles/1.0.0/9/</url>
    </elevation>

    <model name="buildings" driver="feature_geom">

        <features name="buildings" driver="tfs">                        
            <url>http://readymap.org/readymap/features/tfs/4/</url>
            <format>json</format>            
        </features>

        <layout>        
            <tile_size_factor>5.0</tile_size_factor>
        </layout>

        <styles>                
            <style type="text/css">
                b1 {
                    extrusion-height:  15;
                    extrusion-flatten: true;
                    fill:              #ff7f2f;
                    altitude-clamping: terrain;
                    altitude-resolution: 0.1;
                }
                b2 {
                    extrusion-height:  30;
                    extrusion-flatten: true;
                    fill:              #2f7fff;
                    altitude-clamping: terrain;
                    altitude-resolution: 0.1;
                }
                b3 {
                    extrusion-height:  45;
                    extrusion-flatten: true;
                    fill:              #ff2f7f;
                    altitude-clamping: terrain;
                    altitude-resolution: 0.1;
                }
            </style>

            <selector name="default" style_expr="selectStyle()"/>

            <script language="javascript">
            <![CDATA[
                rotator = 0;
                function selectStyle() {
                    rotator = (rotator+1)%3;
                    if      (rotator==0) return "b1";
                    else if (rotator==1) return "b2";
                    else                 return "b3";
                }
            ]]>
            </script>
        </styles>  

        <lighting>true</lighting>
    </model>

    <image name="mapquest_osm" driver="xyz">
        <url>http://otile[1234].mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg</url>
        <profile>global-mercator</profile>
    </image>

    <external>
        <sky hours="20.0"/>
        <viewpoint name="Mexico Buildings" height="0" lat="19.42" long="-99.163" pitch="-89" range="5000"/>
    </external>

</map>

and switch on/off the elevation. Then you see that the buildings are under the ground.

gwaldron commented 9 years ago

I believe this was due to an issue with the readymap dataset. Cannot reproduce now.