当前位置:网站首页>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 !" );
}
边栏推荐
- [at] abc 258G - Triangle 三元組可達-暴力
- What is definition? What is a statement? What is the difference between them?
- Redis profile
- Go language foundation ----- 08 ----- interface
- opensips与对方tls sip trunk对接注意事项
- Analysis of the eighth Blue Bridge Cup single chip microcomputer provincial competition
- 哪一刻你才发现青春结束了
- Pat grade a 1027 colors in Mars
- 华为交换机基础配置(telnet/ssh登录)
- [at] ABC 258g - Triangle triples reachable - violence
猜你喜欢

密西根大学张阳教授受聘中国上海交通大学客座教授(图)

Technical dry goods | some thoughts on the future of AI architecture

PAT甲级 1030 Travel Plan

Screenshot tool snipaste
![[MySQL 14] use dbeaver tool to remotely backup and restore MySQL database (Linux Environment)](/img/38/3435d353e50b19fe09c8ab9db52204.png)
[MySQL 14] use dbeaver tool to remotely backup and restore MySQL database (Linux Environment)

vcs import src < ros2. Repos failed

The difference between hdmi2.1 and hdmi2.0 and the conversion of PD signals.

一篇文章让你读懂-曼彻斯特编码

Unity XR实现交互(抓取,移动旋转,传送,射击)-Pico

Technical dry goods | thinking about the unification of dynamic and static diagrams of AI framework
随机推荐
Technical dry goods | thinking about the unification of dynamic and static diagrams of AI framework
PAT甲级 1028 List Sorting
技术干货|昇思MindSpore Lite1.5 特性发布,带来全新端侧AI体验
Redis view client connection
PAT甲级 1031 Hello World for U
PIP uses image website to solve the problem of slow network speed
【LeetCode】3. Merge Two Sorted Lists·合并两个有序链表
密西根大学张阳教授受聘中国上海交通大学客座教授(图)
HDMI2.1与HDMI2.0的区别以及转换PD信号。
Go language foundation ----- 10 ----- string related operations (operation function, string conversion)
Huawei switch console password reset, device initialization, default password
Go language - loop statement
[MySQL 14] use dbeaver tool to remotely backup and restore MySQL database (Linux Environment)
Go language foundation ----- 04 ----- closure, array slice, map, package
Lucene introduces NFA
Technical dry goods | hundred lines of code to write Bert, Shengsi mindspire ability reward
PHP常用排序算法
Analysis of the problems of the 7th Blue Bridge Cup single chip microcomputer provincial competition
Microsoft Security Response Center
Technical dry goods | some thoughts on the future of AI architecture