Geotools在shapefile路网数据中建立缓冲区,并获取缓冲区内的要素
记录一下如何创建创建缓冲区并获取缓冲区内的要素,便于以后查找使用
static SimpleFeatureSource featureSource = null;
static CoordinateReferenceSystem targetCRS;
static String geometryPropertyName;
static FilterFactory2 ff;
public SimpleFeatureCollection grabFeaturesInBoundingBox(double x1, double y1, double x2, double y2)
throws Exception {
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
ShapefileDataStore sds = (ShapefileDataStore)dataStoreFactory.createDataStore
(new File("E://Merge_direction.shp").toURI().toURL()); Charset charset = Charset.forName("GBK");
sds.setCharset(charset);
String typeName = sds.getTypeNames()[0];
featureSource = sds.getFeatureSource (typeName);
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
FeatureType schema = featureSource.getSchema(); geometryPropertyName = schema.getGeometryDescriptor().getLocalName();
targetCRS = schema.getGeometryDescriptor().getCoordinateReferenceSystem(); ReferencedEnvelope bbox = new ReferencedEnvelope(x1, y1, x2, y2, targetCRS); Filter filter = ff.bbox(ff.property(geometryPropertyName), bbox);
return featureSource.getFeatures(filter);
}
Geotools在shapefile路网数据中建立缓冲区,并获取缓冲区内的要素的更多相关文章
- Geotools求shapefile路网中任意两点之间最短路径的距离
前言:之前在博问求助过这个问题.经过几天的思考,算是解决了(但仍有不足),另一方面对Geotools不是很熟,有些描述可能不正确,希望大家批评指正. 问题:作为一个新手,我并没有发现Geotools中 ...
- Geotools中读取shapefile路网数据,并创建DirectedGraph
记录一下如何创建DirectedGraph,便于以后查找使用 static ShapefileDataStore sds= null; static DirectedGraph graph = nul ...
- geotools导出shapefile出错: java.io.IOException: Current fid index is null, next must be called before write()
geotools导出shapefile出错: java.io.IOException: Current fid index is null, next must be called before wr ...
- GeoServer基础教程(三):部署发布Shapefile地图数据
转载:http://blog.csdn.net/mingzai624. 这是GeoServer官方网站提供的一份Shapefile测试数据 nyc_roads.zip ,包含了部分纽约的道路信息,我们 ...
- geotools修改shapefile 属性名乱码问题
在GeoServer中文社区的讨论地址为:http://opengeo.cn/bbs/read.php?tid=1701&page=e&#a 使用geotools修改shapefile ...
- (数据科学学习手札80)用Python编写小工具下载OSM路网数据
本文对应脚本已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 我们平时在数据可视化或空间数据分析的过程中经常会 ...
- Dynamics AX 2012 在BI分析中建立数据仓库的必要性
AX系统已有的BI分析架构 对于AX 的BI分析架构,相信大家都了解,可以看Reinhard之前的译文[译]Dynamics AX 2012 R2 BI系列-分析的架构 . AX 的BI分析架构的优势 ...
- 多表利用DIH批量导入数据并建立索引注意事项
如果希望同时对多个表进行全文检索,那我们该如何处理呢?利用DIH导入数据并建立索引时.schema.xml中配置了uniqueKey为id <uniqueKey>id</unique ...
- Android 中建立一个OpenGL ES的开发环境
转自: http://wiki.eoe.cn/page/Building_an_OpenGL_ES_Environment.html 负责人:zhangql原文链接:http://docs.eoean ...
随机推荐
- 体验vSphere 6之1-安装VMware ESXi 6 RC版(转载)
体验vSphere 6之1-安装VMware ESXi 6 RC版 在2015年,各个公司都会发布一系列新的产品,例如Microsoft会发布Windows 10,VMware会发布vSphere 6 ...
- tomcat启动不了的问题
tomcat启动的几个问题 1.端口冲突 2.非端口冲突,需要加入配置host文件 日志文件: 解决办法:https://blog.csdn.net/u012949658/article/detail ...
- 利用.swp文件恢复源文件
使用命令 vim -r filename.swp 保存即可
- 【Linux_Shell 脚本编程学习笔记二、打印菜单】
综合实例: 打印选择菜单,一键安装Web服务 [root@zuoyan script]# sh menu.sh 1.[install lamp] 2. [install lnmp] 3. [ex ...
- MyBatis学习笔记一:MyBatis最简单的环境搭建
MyBatis的最简单环境的搭建,使用xml配置,用来理解后面的复杂配置做基础 1.环境目录树(导入mybatis-3.4.1.jar包即可,这里是为后面的环境最准备使用了web项目,如果只是做 my ...
- 学习和使用 Styled Layer Descriptor SLD样式文件
1. SLD 文件大致作用,可以浏览下示意图: 点要素的符号化:http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/points ...
- btrace简单使用
基本安装 在github上btrace项目的release下 下载最新的btracehttps://github.com/btraceio/btrace/releases 解压完后,将btrace的b ...
- js编写trim()函数
1.js中本身是没有trim函数的,不过你可以自己写一个 function trim(str) { var newStr = str.replace(/^\s*$/g,'') retr ...
- 【转载】python3安装scrapy之windows32位爬坑
python3安装scrapy之windows32位爬坑 原创 2016年11月06日 01:38:08 标签: scrapy / windows / python / 开源框架 / 网络爬虫 早 ...
- 单点登录CAS系列第06节之客户端配置单点登录
原理 纯web.xml 借助Spring 注意 代码 测试 原理 这里用的是:cas-client-core-3.4.0.jar(2015-07-21发布的) 下载地址为:http://mvnrepo ...