当前位置:网站首页>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 !" );
}
边栏推荐
- 创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
- [MySQL 12] MySQL 8.0.18 reinitialization
- Huawei switch basic configuration (telnet/ssh login)
- Lucene introduces NFA
- How does yarn link help developers debug NPM packages?
- Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)
- Project experience sharing: realize an IR Fusion optimization pass of Shengsi mindspire layer
- Go language foundation ----- 11 ----- regular expression
- Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
- experiment.........
猜你喜欢

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

【MySQL 12】MySQL 8.0.18 重新初始化

【LeetCode】2. Valid parentheses · valid parentheses

Go language foundation ----- 01 ----- go language features

Analysis of the problems of the 10th Blue Bridge Cup single chip microcomputer provincial competition

技术干货|昇思MindSpore算子并行+异构并行,使能32卡训练2420亿参数模型

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

LwIP learning socket (application)

What is a data type? What is the use of data types?
随机推荐
Go language foundation ----- 13 ----- file
Go language foundation ----- 11 ----- regular expression
华为交换机Console密码重置、设备初始化、默认密码
Project experience sharing: realize an IR Fusion optimization pass of Shengsi mindspire layer
Technical dry goods | alphafold/ rosettafold open source reproduction (2) - alphafold process analysis and training Construction
技术干货|昇思MindSpore算子并行+异构并行,使能32卡训练2420亿参数模型
Technology dry goods | Roberta of the migration of mindspore NLP model - emotion analysis task
Go language foundation ------ 14 ------ gotest
Technical dry goods Shengsi mindspire lite1.5 feature release, bringing a new end-to-end AI experience
Go language foundation ----- 02 ----- basic data types and operators
[MySQL 12] MySQL 8.0.18 reinitialization
[step on the pit series] MySQL failed to modify the root password
UA camouflage, get and post in requests carry parameters to obtain JSON format content
PAT甲级 1032 Sharing
【LeetCode】4. Best Time to Buy and Sell Stock·股票买卖最佳时机
Pat class a 1028 list sorting
How to clear the console password for s7700 device
GoLang之结构体
Screenshot tool snipaste
[MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in