资源简介
Shape 转换为 Sqlite 数据 Sqlite 抓获为 Shape
把数据都打印出来了
代码片段和文件信息
package com.suprui.action;
import java.io.File;
import java.nio.charset.Charset;
import java.util.Iterator;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.shapefile.ShapefileDataStoreFactory;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureSource;
import org.opengis.feature.Property;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.type.PropertyType;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
public class shapread {
public static void main(String[] args) {
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
try {
ShapefileDataStore sds = (ShapefileDataStore) dataStoreFactory
.createDataStore(new File(
“E:\\SH_RD\\android_zj\\zdxm\\zdxm_polygon.shp“)
.toURI().toURL());
sds.setStringCharset(Charset.forName(“GBK“));
SimpleFeatureSource featureSource = sds.getFeatureSource();
SimpleFeatureIterator itertor = featureSource.getFeatures()
.features();
while (itertor.hasNext()) {
SimpleFeature feature = itertor.next();
Iterator it = feature.getProperties().iterator();
while (it.hasNext()) {
Property pro = it.next();
if (pro.getValue() instanceof Point) {
System.out.println(“PointX = “
+ ((Point) (pro.getValue())).getX());
System.out.println(“PointY = “
+ ((Point) (pro.getValue())).getY());
}else if(pro.getValue() instanceof Polygon){
System.out.println(pro.getName() + “ = “
+ pro.getValue());
}
else {
PropertyType typeinfo= pro.getType();
System.out.println(typeinfo.getBinding().getName());
System.out.println(pro.getType().getClass().getName());
System.out.println(pro.getName() + “ = “
+ pro.getValue());
}
}
}
itertor.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3147 2013-10-15 14:06 testshap\.classpath
文件 384 2013-10-15 13:03 testshap\.project
文件 629 2012-04-10 09:37 testshap\.settings\org.eclipse.jdt.core.prefs
文件 3833 2013-10-15 14:06 testshap\bin\com\suprui\action\shapread.class
文件 5335 2013-10-15 14:06 testshap\bin\com\suprui\action\testshape.class
文件 4796 2013-10-15 14:06 testshap\bin\com\suprui\action\testwrite.class
文件 127639 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-api-2.7.2.jar
文件 12616 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-charts-2.7.2.jar
文件 426554 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-coverage-2.7.2.jar
文件 172547 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-cql-2.7.2.jar
文件 48702 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-data-2.7.2.jar
文件 30243 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-epsg-extension-2.7.2.jar
文件 1855641 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-epsg-hsql-2.7.2.jar
文件 6394 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-epsg-postgresql-2.7.2.jar
文件 182112 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-epsg-wkt-2.7.2.jar
文件 42617 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-feature-pregeneralized-2.7.2.jar
文件 46274 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-geojson-2.7.2.jar
文件 24680 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-geotiff-2.7.2.jar
文件 35544 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-gtopo30-2.7.2.jar
文件 21059 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-image-2.7.2.jar
文件 86701 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-jdbc-spatialite-2.7.2.jar
文件 66750 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-jp2k-2.7.2.jar
文件 1304365 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-main-2.7.2.jar
文件 486021 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-me
文件 327623 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-opengis-2.7.2.jar
文件 72369 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-process-2.7.2.jar
文件 20893 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-property-2.7.2.jar
文件 1059440 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-referencing-2.7.2.jar
文件 236015 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-referencing3D-2.7.2.jar
文件 384060 2013-10-15 11:52 testshap\lib\geotools-2.7.2\gt-render-2.7.2.jar
............此处省略30个文件信息
相关资源
- 简明英汉词典数据库
- SQLite官方学习手册全 中文
- Navicat for SQLite 11.2.11 - 破解版 - 带注册
- DB.Browser.rar
- sqlite-netFx46-setup-bundle-x64-2015-1.0.108.0
- Notepad++Lua及sqlite数据库助手插件包
- 汉语词典Sqlite
- dotConnect for SQLite
- 一个不错的词典数据库,用mdx转成s
- sqlite经典书籍.zip
- SQLiteExpertPersonal最新版
- SQLiteStudio-3.2.1
- Navicat11.0.7破解版
- KoboReader.sqlite
- 96440英文单词SQLite数据库,包含解释、
- Navicat_for_SQLite破解版
- 基于QT4.8.6的软键盘
- 学生信息管理系统基于SQLite
- 百度、高德,WGS84坐标批量转换工具
- navicatforsqlite_破解版
- SQLiteExpert
- Sqlite数据库查看器
- Navicat for SQLite
- SQLite数据库版本升级
- SQLiteExpert 中文破解版
- SQLiteExpert_5.3.0.327_x64&x86;含注册码/内含
-
SQLite和Entityfr
amework6配合使用的 - GDAL_BUILD(release).rar
- 基于安卓的考试系统
- easyFamily.zip
评论
共有 条评论