Geotools 对shp数据的样式修改
2016-10-06 17:18
477 查看
先来看下效果 代码如下 File file = JFileDataStoreChooser.showOpenFile("shp", null);if (file == null) {return;}FileDataStore store = FileDataStoreFinder.getDataStore(file);//设置编码格式((ShapefileDataStore) store).setCharset(Charset.forName("GBK"));SimpleFeatureSource featureSource = store.getFeatureSource();// Create a map context and add our shapefile to itMapContext map = new DefaultMapContext();//获取sld文件org.geotools.styling.StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();File stylefile = new File("sld文件路径xxx.sld");SLDParser stylereader = new SLDParser(styleFactory, stylefile.toURI().toURL());org.geotools.styling.Style[] stylearray = stylereader.readXML();org.geotools.styling.Style style = stylearray[0];
//构建图层 FeatureLayer tempLayer = new FeatureLayer(featureSource, style); map.setTitle("Start"); map.addLayer(tempLayer);
JMapFrame.showMap(map);
相关文章推荐
- 基于 bootstrap 的数据展示--bootgrid 样式修改。
- geoTools向shp文件中写数据
- GDAL修改shp矢量数据的属性值
- Android开发修改DialogFragment样式以及与activity之间的数据传递
- echarts 无数据时气泡的修改 背景颜色/动画样式 noDataLoadingOption
- v-for循环出的数据怎么修改其样式(this.$nextTick)
- 基于 bootstrap 的数据展示--bootgrid 样式修改。
- geotools实现shp数据的缓冲区分析
- 利用webgrid实现数据的批处理(添加和修改)
- 如何修改mysql数据文件位置
- 用Nhibernate怎么实现数据的添加、删除、修改简单程序
- 又修改了Lighty皮肤的一些样式
- *.cpl文件的妙用(随意修改cpu显示数据,内存显示随意修改等等)
- 修改数据时出错
- 修改SQL2000数据表的Owner为dbo
- 用Nhibernate怎么实现数据的添加、删除、修改简单程序
- 修改oracle的数据文件
- 另类DATAGRID数据编辑修改
- mx.validators.Validator的错误提示文字的样式修改
- 我对自己blog模版样式得一些修改!