当前位置:网站首页>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 !" );
}
边栏推荐
- Go language foundation ------ 14 ------ gotest
- 【MySQL 13】安装MySQL后第一次修改密码,可以可跳过MySQL密码验证进行登录
- Harmonyos third training notes
- 技术干货|昇思MindSpore NLP模型迁移之Bert模型—文本匹配任务(二):训练和评估
- 华为交换机基础配置(telnet/ssh登录)
- s7700设备如何清除console密码
- experiment.........
- LwIP learning socket (application)
- 【踩坑系列】mysql 修改root密码失败
- Go language foundation ----- 15 ----- reflection
猜你喜欢
Go language foundation ----- 08 ----- interface
技术干货|昇思MindSpore NLP模型迁移之Roberta ——情感分析任务
[step on the pit series] MySQL failed to modify the root password
Technical dry goods Shengsi mindspire dynamic transformer with variable sequence length has been released!
Technical dry goods Shengsi mindspire elementary course online: from basic concepts to practical operation, 1 hour to start!
技术干货|昇思MindSpore创新模型EPP-MVSNet-高精高效的三维重建
Iterm2 setting
[MySQL 11] how to solve the case sensitive problem of MySQL 8.0.18
Go language foundation ----- 07 ----- method
Go language foundation ------ 14 ------ gotest
随机推荐
项目经验分享:基于昇思MindSpore,使用DFCNN和CTC损失函数的声学模型实现
opensips与对方tls sip trunk对接注意事项
Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
WorldView卫星遥感影像数据/米级分辨率遥感影像
哪一刻你才发现青春结束了
【踩坑系列】mysql 修改root密码失败
【LeetCode】4. Best Time to Buy and Sell Stock·股票买卖最佳时机
Huawei switch console password reset, device initialization, default password
Go language foundation ----- 13 ----- file
【LeetCode】2. Valid Parentheses·有效的括号
What is a data type? What is the use of data types?
Harmonyos third training notes
Redis查看客户端连接
Microsoft Security Response Center
Redis batch startup and shutdown script
What is definition? What is a statement? What is the difference between them?
【LeetCode】3. Merge two sorted lists · merge two ordered linked lists
技术干货|昇思MindSpore初级课程上线:从基本概念到实操,1小时上手!
Pat class a 1028 list sorting
[MySQL 12] MySQL 8.0.18 reinitialization