我有兴趣为道路数据编写可视化程序2009 Tiger/Line 形状文件 http://www.census.gov/geo/www/tiger/tgrshp2009/documentation.html。我想绘制线路数据来显示我所在县的所有道路。
ESRI Shapefile 或只是一个
shapefile 是一种流行的地理空间文件
地理矢量数据格式
信息系统软件。这是
由 ESRI 开发和监管
(大部分)开放数据规范
ESRI 和其他公司之间的互操作性
软件产品。1 http://www.census.gov/geo/www/tiger/tgrshp2009/documentation.html一个“形状文件”
通常指的是集合
带有“.shp”、“.shx”、“.dbf”的文件
公共前缀上的其他扩展
名称(例如“湖泊。*”)。实际上
shapefile具体涉及
扩展名为“.shp”的文件,
然而这个文件本身并不完整
用于分发,与其他
需要支持文件。
有谁知道现有的用于解析和读取行数据的库形状文件 http://en.wikipedia.org/wiki/Shapefile?
GeoTools http://geotools.org/会做的。有大量的罐子,但大多数都是你不需要的。然而,读取 shapefile 只需几行。
File file = new File("mayshapefile.shp");
try {
Map<String, String> connect = new HashMap();
connect.put("url", file.toURI().toString());
DataStore dataStore = DataStoreFinder.getDataStore(connect);
String[] typeNames = dataStore.getTypeNames();
String typeName = typeNames[0];
System.out.println("Reading content " + typeName);
FeatureSource featureSource = dataStore.getFeatureSource(typeName);
FeatureCollection collection = featureSource.getFeatures();
FeatureIterator iterator = collection.features();
try {
while (iterator.hasNext()) {
Feature feature = iterator.next();
GeometryAttribute sourceGeometry = feature.getDefaultGeometryProperty();
}
} finally {
iterator.close();
}
} catch (Throwable e) {}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)