当前位置:网站首页>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 !" );
}
边栏推荐
- 【MySQL 14】使用DBeaver工具远程备份及恢复MySQL数据库(Linux 环境)
- [at] abc 258G - Triangle 三元組可達-暴力
- Redis view client connection
- 一个实习生的CnosDB之旅
- 华为S5700交换机初始化和配置SSH和TELNET远程登录方法
- 【LeetCode】2. Valid parentheses · valid parentheses
- PHP wechat red packet grabbing algorithm
- How to clear the console password for s7700 device
- vcs import src < ros2. Repos failed
- Technical dry goods Shengsi mindspire elementary course online: from basic concepts to practical operation, 1 hour to start!
猜你喜欢

LwIP learning socket (application)

研究显示乳腺癌细胞更容易在患者睡觉时进入血液

PAT甲级 1030 Travel Plan

Go language foundation ----- 04 ----- closure, array slice, map, package

Robots protocol

一个实习生的CnosDB之旅
![[MySQL 12] MySQL 8.0.18 reinitialization](/img/e1/9874df18bbc8d80c3c5c5fe39aefc9.png)
[MySQL 12] MySQL 8.0.18 reinitialization

Go language foundation ----- 02 ----- basic data types and operators

PAT甲级 1031 Hello World for U

PAT甲级 1032 Sharing
随机推荐
PHP wechat red packet grabbing algorithm
Technology dry goods | luxe model for the migration of mindspore NLP model -- reading comprehension task
[MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
Go language - loop statement
哪一刻你才发现青春结束了
技术干货|利用昇思MindSpore复现ICCV2021 Best Paper Swin Transformer
【MySQL 12】MySQL 8.0.18 重新初始化
Register keyword
Technical dry goods Shengsi mindspire innovation model EPP mvsnet high-precision and efficient 3D reconstruction
Huawei switch: configure Telnet, SSH and web access
Go language foundation ----- 02 ----- basic data types and operators
Partage de l'expérience du projet: mise en œuvre d'un pass optimisé pour la fusion IR de la couche mindstore
Go language foundation ------17 ----- channel creation, read-write, security shutdown, multiplexing select
截图工具Snipaste
[at] abc 258G - Triangle 三元組可達-暴力
PHP微信抢红包的算法
OSPF protocol summary
Research shows that breast cancer cells are more likely to enter the blood when patients sleep
What is definition? What is a statement? What is the difference between them?