当前位置:网站首页>How to configure GDAL under idea
How to configure GDAL under idea
2022-07-03 07:50:00 【A reserved and calm man】
1. download gdal Compress and unzip the package
2. Reference in project gdal.jar
3. quote dll file
take dll Copy the file to the root directory of the project
4. take shpfile File transfer out geojson file
public static void main(String[] args) {
// Register all drivers
ogr.RegisterAll();
// In order to support Chinese path , Please add the following code
gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8","YES");
// In order to make the property sheet fields support Chinese , Please add the following sentence
gdal.SetConfigOption("SHAPE_ENCODING","");
//shp File location
String strVectorFile = "C:\\Users\\10469\\Desktop\\ Township \\ Township .shp";
// Open the data
DataSource ds = ogr.Open(strVectorFile,0);
if (ds == null)
{
System.out.println(" fail to open file !" );
return;
}
System.out.println(" File opened successfully !" );
Driver dv = ogr.GetDriverByName("GeoJSON");
if (dv == null)
{
System.out.println(" Failed to open driver !" );
return;
}
System.out.println(" Turn on the driver successfully !" );
// Output geojson Location and file name of
dv.CopyDataSource(ds, "C:\\Users\\10469\\Desktop\\ Township \\ Township .json");
System.out.println(" Conversion success !" );
System.out.println(System.getProperty("java.library.path"));
}
5. take geojson File transfer out shpfile file
public static void main(String[] args) {
// Register all drivers
ogr.RegisterAll();
// In order to support Chinese path , Please add the following code
gdal.SetConfigOption("GDAL_FILENAME_IS_UTF8","YES");
// In order to make the property sheet fields support Chinese , Please add the following sentence
gdal.SetConfigOption("SHAPE_ENCODING","");
//shp File location
String strVectorFile = "E:\\opt\\trans.json";
// Open the data
DataSource ds = ogr.Open(strVectorFile,0);
if (ds == null)
{
System.out.println(" fail to open file !" );
return;
}
System.out.println(" File opened successfully " );
String strDriverName = "ESRI Shapefile";
org.gdal.ogr.Driver dv = ogr.GetDriverByName(strDriverName);
if (dv == null)
{
System.out.println(" Failed to open driver !" );
return;
}
System.out.println(" Turn on the driver successfully !" );
// Output geojson Location and file name of
dv.CopyDataSource(ds, "E:\\opt\\trans\\test.shp");
System.out.println(" Conversion success !" );
}
边栏推荐
- PAT甲级 1029 Median
- opensips与对方tls sip trunk对接注意事项
- Go language foundation ----- 06 ----- anonymous fields, fields with the same name
- C2 several methods of merging VCF files
- 技术干货|昇思MindSpore算子并行+异构并行,使能32卡训练2420亿参数模型
- 項目經驗分享:實現一個昇思MindSpore 圖層 IR 融合優化 pass
- Go language foundation ----- 01 ----- go language features
- Analysis of the problems of the 7th Blue Bridge Cup single chip microcomputer provincial competition
- register关键字
- 技术干货|百行代码写BERT,昇思MindSpore能力大赏
猜你喜欢
LwIP learning socket (application)
Unity XR实现交互(抓取,移动旋转,传送,射击)-Pico
Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
Iterm2设置
[mindspire paper presentation] summary of training skills in AAAI long tail problem
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
Analysis of the problems of the 7th Blue Bridge Cup single chip microcomputer provincial competition
技术干货|关于AI Architecture未来的一些思考
Pat grade a 1029 median
PAT甲级 1028 List Sorting
随机推荐
【MindSpore论文精讲】AAAI长尾问题中训练技巧的总结
输入三次猜一个数字
Pat class a 1031 Hello world for u
Lucene introduces NFA
Huawei s5700 switch initialization and configuration SSH and telnet remote login methods
[at] abc 258G - Triangle 三元組可達-暴力
When did you find out that youth was over
PAT甲级 1031 Hello World for U
Analysis of the problems of the 10th Blue Bridge Cup single chip microcomputer provincial competition
Go language foundation ------ 14 ------ gotest
Go language foundation ----- 04 ----- closure, array slice, map, package
华为交换机Console密码重置、设备初始化、默认密码
华为交换机配置ssh登录远程管理交换机
LwIP learning socket (API)
PHP微信抢红包的算法
【cocos creator】获取资源uuid
研究显示乳腺癌细胞更容易在患者睡觉时进入血液
Worldview satellite remote sensing image data / meter resolution remote sensing image
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
HDMI2.1与HDMI2.0的区别以及转换PD信号。