当前位置:网站首页>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 !" );
}
边栏推荐
- Structure of golang
- PAT甲级 1029 Median
- s7700设备如何清除console密码
- 【LeetCode】2. Valid Parentheses·有效的括号
- Redis查看客户端连接
- Partage de l'expérience du projet: mise en œuvre d'un pass optimisé pour la fusion IR de la couche mindstore
- 項目經驗分享:實現一個昇思MindSpore 圖層 IR 融合優化 pass
- Huawei switches are configured with SSH login remote management switches
- WorldView卫星遥感影像数据/米级分辨率遥感影像
- 基于RNA的新型癌症疗法介绍
猜你喜欢

【LeetCode】3. Merge Two Sorted Lists·合并两个有序链表

PAT甲级 1030 Travel Plan

Technical dry goods | reproduce iccv2021 best paper swing transformer with Shengsi mindspire

HarmonyOS第三次培训笔记

Pat grade a 1029 median

PAT甲级 1031 Hello World for U

Project experience sharing: handwritten Chinese character recognition based on Shengsi mindspire

Technical dry goods Shengsi mindspire elementary course online: from basic concepts to practical operation, 1 hour to start!

【MindSpore论文精讲】AAAI长尾问题中训练技巧的总结

Analysis of the problems of the 10th Blue Bridge Cup single chip microcomputer provincial competition
随机推荐
【MindSpore论文精讲】AAAI长尾问题中训练技巧的总结
Huawei switch: configure Telnet, SSH and web access
华为交换机基础配置(telnet/ssh登录)
What is a data type? What is the use of data types?
HarmonyOS第三次培训笔记
Harmonyos third training notes
Pat grade a 1027 colors in Mars
Go language foundation ----- 13 ----- file
Go language foundation ----- 07 ----- method
What is definition? What is a statement? What is the difference between them?
Static keyword
Analysis of the eighth Blue Bridge Cup single chip microcomputer provincial competition
华为S5700交换机初始化和配置SSH和TELNET远程登录方法
Technical dry goods Shengsi mindspire dynamic transformer with variable sequence length has been released!
C2 several methods of merging VCF files
技术干货 | AlphaFold/ RoseTTAFold开源复现(2)—AlphaFold流程分析和训练构建
截图工具Snipaste
[step on the pit series] MySQL failed to modify the root password
Go language foundation ----- 16 ----- goroutine, GPM model
[MySQL 14] use dbeaver tool to remotely backup and restore MySQL database (Linux Environment)