gdal--矢量求交

前言

最近在帮同学写几个小程序,包括矢量数据求交(Intersection)。网上相关文章很少,所以我参考GDAL官网写了一个完整的程序(裁剪、合并、擦除、更新等功能只要修改代码的求交函数部分,下面会有说明)。


代码

#include "gdal_priv.h"  
#include "ogrsf_frmts.h" //for ogr 

bool VectorIntersection(const char *pszSrcShp, const char *pszMethodShp, const char *pszDstShp, const char* pszFormat);

int main()
{
    const char *pszSrcFile = "C:\\Users\\liuwei\\Desktop\\CreateIm\\shpManage\\SrcLayer.shp";//原始文件
    const char *pszMethodFile = "C:\\Users\\liuwei\\Desktop\\CreateIm\\shpManage\\MethodLayer.shp";//用来求交的文件
    const char *pszOutFile = "C:\\Users\\liuwei\\Desktop\\shp\\Intersection.shp";//求交后的结果文件
    VectorIntersection(pszSrcFile, pszMethodFile, pszOutFile, "ESRI Shapefile");//矢量数据求
  • 4
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 19
    评论
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值