记录一下如何创建创建缓冲区并获取缓冲区内的要素,便于以后查找使用

     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路网数据中建立缓冲区,并获取缓冲区内的要素的更多相关文章

  1. Geotools求shapefile路网中任意两点之间最短路径的距离

    前言:之前在博问求助过这个问题.经过几天的思考,算是解决了(但仍有不足),另一方面对Geotools不是很熟,有些描述可能不正确,希望大家批评指正. 问题:作为一个新手,我并没有发现Geotools中 ...

  2. Geotools中读取shapefile路网数据,并创建DirectedGraph

    记录一下如何创建DirectedGraph,便于以后查找使用 static ShapefileDataStore sds= null; static DirectedGraph graph = nul ...

  3. 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 ...

  4. GeoServer基础教程(三):部署发布Shapefile地图数据

    转载:http://blog.csdn.net/mingzai624. 这是GeoServer官方网站提供的一份Shapefile测试数据 nyc_roads.zip ,包含了部分纽约的道路信息,我们 ...

  5. geotools修改shapefile 属性名乱码问题

    在GeoServer中文社区的讨论地址为:http://opengeo.cn/bbs/read.php?tid=1701&page=e&#a 使用geotools修改shapefile ...

  6. (数据科学学习手札80)用Python编写小工具下载OSM路网数据

    本文对应脚本已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 我们平时在数据可视化或空间数据分析的过程中经常会 ...

  7. Dynamics AX 2012 在BI分析中建立数据仓库的必要性

    AX系统已有的BI分析架构 对于AX 的BI分析架构,相信大家都了解,可以看Reinhard之前的译文[译]Dynamics AX 2012 R2 BI系列-分析的架构 . AX 的BI分析架构的优势 ...

  8. 多表利用DIH批量导入数据并建立索引注意事项

    如果希望同时对多个表进行全文检索,那我们该如何处理呢?利用DIH导入数据并建立索引时.schema.xml中配置了uniqueKey为id <uniqueKey>id</unique ...

  9. Android 中建立一个OpenGL ES的开发环境

    转自: http://wiki.eoe.cn/page/Building_an_OpenGL_ES_Environment.html 负责人:zhangql原文链接:http://docs.eoean ...

随机推荐

  1. VM Storage Policies深度解析

  2. 如何创建Hexo站点的Tags和Categories默认页面

    安装Hexo的categories生成插件 1 $ npm install hexo-generator-category --save 安装Hexo的Tags生成插件 1 $ npm install ...

  3. printf 输出浮点数

    在测试printf函数输出结果时,写了如下代码: /** * printf:格式化输出函数 * printf函数不会按照格式控制而对数据类型进行转换,不管三七二十一, * 抓到二进制数据就按照格式控制 ...

  4. python 添加字符串的七种方法

    #使用{}的方法 s1 = 'Hello {}! My name is {}.'.format('World', 'Python猫') print(s1) s2 = 'Hello {0} My nam ...

  5. react 踩坑记

    yarn  node-sass 安装失败 yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass yarn i ...

  6. moment获取2周后日期

    moment().add('days',14).format('YYYY年MM月DD日');

  7. 用Gitolite搭建服务器上的Git

    使用git作为版本控制工具,确实非常流行且好用,常用的git代码服务器有Github还是国内的Gitcafe和OSC都是很不错,可以免费存放一些开源的项目代码,对于私人项目,则需要支付一定的费用.同时 ...

  8. 测试LFI WITH PHPINO过程中的一些记录

    原理:以往LFI漏洞都是需要满足两个条件:1.攻击者上传一个含PHP代码的的文件,后缀名任意,没有后缀名也可以:2.需要知道上传后的文件路径及文件名,然后包含之. 后来有国外研究者发现了新的攻击方式, ...

  9. Windows下python3登陆和操作linux服务器

    一.环境准备 python3远程连接需要用到pycrytodome和paramiko库,其中后者依赖前者,所以按照顺序来安装 1. 安装pycrytodome 1 pip install pycryt ...

  10. 1——PHP常见的系统常量

    */ * Copyright (c) 2016,烟台大学计算机与控制工程学院 * All rights reserved. * 文件名:text.cpp * 作者:常轩 * 微信公众号:Worldhe ...