hello,everyone!<br>I couldn't succeed to use OGRGeometry's Union/Intersection/Difference function. Union two Geometrys,but get a null value. I couldn't find some errors.<br>the following code,thanks.<br><br>{<br>OGRRegisterAll();<br><br>&nbsp;&nbsp;&nbsp; OGRDataSource&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *poDS;<br>&nbsp;&nbsp;&nbsp; poDS = OGRSFDriverRegistrar::Open("f:\\t1.shp", FALSE ); // Only include two polygon features. SRS is null. <br>&nbsp;&nbsp;&nbsp; if( poDS == NULL )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf( "Open failed.\n%s" );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit( 1 );<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; OGRLayer *poLayer;<br>&nbsp;&nbsp;&nbsp; poLayer = poDS-&gt;GetLayerByName( "t1" );<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; OGRFeature *poFeature0;<br>&nbsp;&nbsp;&nbsp; OGRFeature *poFeature1;<br>&nbsp;&nbsp;&nbsp; poLayer-&gt;ResetReading();<br>&nbsp;&nbsp;&nbsp;&nbsp; poFeature0=poLayer-&gt;GetNextFeature();<br>&nbsp;&nbsp;&nbsp; poFeature1=poLayer-&gt;GetNextFeature();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; OGRGeometry *geoS0;<br>&nbsp;&nbsp;&nbsp; OGRGeometry *geoS1;<br>&nbsp;&nbsp;&nbsp; geoS0=poFeature0-&gt;GetGeometryRef();<br>&nbsp;&nbsp;&nbsp; geoS1=poFeature1-&gt;GetGeometryRef();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; OGRPolygon *pgon0=(OGRPolygon*)geoS0;<br>&nbsp;&nbsp;&nbsp; OGRPolygon *pgon1=(OGRPolygon*)geoS1;<br><br>&nbsp;&nbsp;&nbsp; OGRGeometry *g2=geoS0-&gt;Intersection(geoS1);<br>//OGRGeometry *g2=geoS0-&gt;Union(geoS1);...<br>//g2 always is null?<br><br>&nbsp;OGRFeature::DestroyFeature( poFeature0 );<br>&nbsp;&nbsp;&nbsp; OGRFeature::DestroyFeature( poFeature1 );<br>OGRDataSource::DestroyDataSource( poDS );<br>}<br><br><br><span title="neteasefooter"/></span>