osggis中重新投影数据有两种方式:1通过TransformFilter类来做,TransformFilter继承于Filter类·;2,在代码中设置投影信息
第一种方法,比较简单,用到osggis封装的类;代码如下:
<graph name="streets">
<filter type="Transform">
<property name="use-terrain-srs" value="true"/>
<property name="localize" value="true"/>
</filter>
.</graph>
第二种方法比较繁琐,设计比较底层:
<!-- Define an SRS based on an OSG WKT description: --> <resource type="srs" name="wgs84"> GEOGCS["WGS84",DATUM["WGS_1984",SPHEROID["WGS84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4326"]] </resource> <!-- A simple filter graph for transforming data into WGS84: --> <graph name="to wgs84"> <filter type="Transform"> <property name="srs" value="'wgs84'"/> </filter> </graph> <!-- The original feature layer, in UTM: --> <source name="streets.utm"> <uri>data/streets-utm.shp</uri> </source> <!-- Our new, intermediate feature layer, in WGS4, along with instructions on building it: --> <source name="streets.wgs84" parent="streets.utm" graph="to wgs84"> <uri>data/streets-wgs84.shp</uri> </source> <!-- The main filter graph for assembling the 3D geometry: --> <graph name="streets"> <filter type="BuildGeom"/> <filter type="Collect"/> <filter type="BuildNodes"/> </graph> <!-- The layer target: --> <layer name="streets" source="streets.wgs84" target="out/streets.ive"> <slice min_range="0" max_range="1e6" graph="streets"/> </layer>