瀏覽代碼

初始化

master
张泽亮 4 年之前
父節點
當前提交
29579d95b0
共有 2 個檔案被更改,包括 5 行新增4 行删除
  1. +5
    -4
      src/main/java/com/appleyk/geotools/GeoUtils.java
  2. 二進制
      target/classes/com/appleyk/geotools/GeoUtils.class

+ 5
- 4
src/main/java/com/appleyk/geotools/GeoUtils.java 查看文件

@@ -28,8 +28,9 @@ public class GeoUtils {
//测试代码
public static void main(String[] args) throws IOException {

JDBCDataStore connnection2mysql = GeoUtils.connnection2mysql("localhost", "gis?serverTimezone=GMT%2B8", 3318, "gly", "glyadmin");
SimpleFeatureSource featureSource = readSHP("D:\\NsgkSoft\\files\\uploadPath\\gis\\china_railways.shp");
JDBCDataStore connnection2mysql = GeoUtils.connnection2mysql("192.168.31.196", "nsgk_hc?serverTimezone=GMT%2B8", 3318, "gly", "glyadmin");
// 会根据shp文件名称创建属性数据table
SimpleFeatureSource featureSource = readSHP("D:\\NsgkSoft\\files\\uploadPath\\gis\\t_geo_hc_house.shp");
JDBCDataStore ds = createTable(connnection2mysql, featureSource);
writeShp2Mysql(ds, featureSource);

@@ -42,8 +43,8 @@ public class GeoUtils {
ShapefileDataStore shpDataStore = null;

shpDataStore = new ShapefileDataStore(file.toURL());
//设置编码
Charset charset = Charset.forName("utf-8");
//设置编码--- 这个不固定,看具体数据
Charset charset = Charset.forName("UTF-8");
shpDataStore.setCharset(charset);
String tableName = shpDataStore.getTypeNames()[0];
featureSource = shpDataStore.getFeatureSource(tableName);


二進制
target/classes/com/appleyk/geotools/GeoUtils.class 查看文件


Loading…
取消
儲存