概述 本文讲述结合geotools实现获取给定点的DEM(tif格式)高程值。 需求描述 1、在web端绘制一条曲线; 2、获取各节点处的高程值; 3、根据高程值绘制高程堆积图。...实现思路及代码 1、绘制曲线,将绘制的结果传给后台 var draw = new ol.interaction.Draw({ source: source...(result) { console.info(result); }) }); 2、后台解析数据并获取点的高程数据...File file = new File(demPath); GeoTiffReader tifReader = new GeoTiffReader(file); GridCoverage2D...2、展示用echart实现的。
概述 本文讲述如何在geotools中实现蜂巢效果。...import org.geotools.grid.GridElement; import org.geotools.grid.GridFeatureBuilder; import org.geotools.grid.PolygonElement...; import org.geotools.data.FileDataStore; import org.geotools.data.FileDataStoreFinder; import org.geotools.data.Transaction...; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.grid.Envelopes; import org.geotools.grid.GridFeatureBuilder...; import org.geotools.grid.Grids; import org.geotools.grid.hexagon.HexagonOrientation; import org.geotools.grid.hexagon.Hexagons
概述 本文讲述如何在geotools中生成泰森多边形,并shp输出。...geotools中的生成 1、创建测试点 ?...; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; import...org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.feature.simple.SimpleFeatureTypeBuilder...; import org.geotools.geometry.jts.JTSFactoryFinder; import org.geotools.referencing.crs.DefaultGeographicCRS
关键点 要实现类似的功能有两个关键点: 1、已经计算过的两个数据不能重复计算; 2、需要保留两个shp图形的属性。 这两点在后面的代码里面会有相对比较详细的注释的。 实现结果 ? ? ?...; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; import...org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.data.simple.SimpleFeatureCollection...; import org.geotools.data.simple.SimpleFeatureIterator; import org.geotools.data.simple.SimpleFeatureSource...* fields1为图层1的字段 * fields2为图层2的字段 */ Map mapFields
概述: 在本文中,讲述如何在geotools中实现shp和geojson数据的相互转换。...; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; import...org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.data.simple.SimpleFeatureCollection...; import org.geotools.data.simple.SimpleFeatureIterator; import org.geotools.data.simple.SimpleFeatureSource...; import org.geotools.geojson.geom.GeometryJSON; import org.geotools.referencing.crs.DefaultGeographicCRS
概述: 本文讲述如何在geotools中实现shp数据的缓冲区分析并保存到shp文件中。...; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; import...org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.data.simple.SimpleFeatureCollection...; import org.geotools.data.simple.SimpleFeatureIterator; import org.geotools.data.simple.SimpleFeatureSource...; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.referencing.crs.DefaultGeographicCRS
概述:从本节开始,博文中会陆陆续续更新一些有关geotools相关的文章。本节讲述的是geotools的开胃菜,打开本地shp文件,并在窗口中显示。 引言:geotools简介。...Geotools主要提供各种GIS算法,各种数据格式的读写和显示。在显示方面要差一些,只是用Swing实现了地图的简单查看和操作。但是用户可以根据Geotools提供的算法自己实现地图的可视化。...OpenJump和udig就是基于Geotools的。 Geotools用到的两个较重要的开源GIS工具包是JTS和GeoAPI。前者主要是实现各种GIS拓扑算法,也是基于GeoAPI的。...OpenJump和udig就是基于Geotools的。 Geotools用到的两个较重要的开源GIS工具包是JTS和GeoAPI。前者主要是实现各种GIS拓扑算法,也是基于GeoAPI的。...1、下载geotools 你可以从geotools官方网站http://geotools.org/下载,但是这个网站有时候会连接不上,为方便下载,我上传至我的百度网盘,下载地址为:http://pan.baidu.com
昨天,有朋友要我帮忙看看一个将经纬度坐标转换成墨卡托投影(墨卡托投影有很多变种,我也不知道他说的是哪一种)的程序,他说转换以后的坐标精度太差。...当时,他的程序没怎么看懂,然后研究了一下Geotools,自己写了一个转换小程序,很简单的几行代码! Geotools是Java语言编写的开源GIS工具包。...该项目已有十多年历史,生命力旺盛,代码非常丰富,包含多个开源GIS项目,并且基于标准的GIS接口。Geotools主要提供各种GIS算法,各种数据格式的读写和显示。...在Eclipse新建Maven工程,添加库和依赖: 这里主要添加的是要下载Geotools的库: maven2-repository.dev.java.net.../ 以及用到的Geotools库: <
具体mongodb的安装参照官方文档,强烈建议参照官方安装文档。网上博客这种资料良莠不齐,而且新版本可能和老板的安装略有区别,博客中的安装方法不一定适合你。所以,一句话,参照官方文档进行安装。...开发语言为Java,开发工具为GeoTools和mongodb的Java Driver。...具体实现思想是:首先使用GeoTools读取shapefile文件,然后遍历每个feature,将feature转为GeoJSON的字符串。...每个GeoJSON的字符串作为mongodb的collection中的一个document。...地理坐标系,所以我们使用2dsphere索引在geometry字段上建立索引。
/** * 根据几何模型进行影像切割 * @param reader 原始印象 * @param geom 几何模型 */ public static GridCoverage2D SplitImageByGeometry...Coordinate(minX,maxY)); Point lbPoint = geomFactory.createPoint(new Coordinate(maxX,minY)); //对应到行列的左上右下...minY,maxX - minX,maxY - minY); GridCoverageFactory gridFactory = new GridCoverageFactory(); GridCoverage2D...new GridSampleDimension[1]; //sampleDimesion[0] = reader.read(null).getSampleDimension(0); //GridCoverage2D
概述: 本文讲解通过Geotools实现用shp和sld导出图片。...实现: 生成后的图片 实现代码: package com.lzugis.geotools; import java.awt.Graphics; import java.awt.Graphics2D;...; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.map.FeatureLayer; import org.geotools.map.Layer...org.geotools.renderer.lite.StreamingRenderer; import org.geotools.styling.SLDParser; import org.geotools.styling.Style...2、出图是需要结合地图分辨率的。
裁剪区域数据 实现代码: 1、geotools package com.lzugis.geotools; import com.amazonaws.util.json.JSONObject; import...com.lzugis.CommonMethod; import com.lzugis.geotools.utils.FeaureUtil; import com.lzugis.geotools.utils.GeoJSONUtil...; import com.vividsolutions.jts.geom.Geometry; import org.geotools.data.FeatureSource; import org.geotools.data.shapefile.ShapefileDataStore...; import org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureSource...; import org.geotools.feature.FeatureCollection; import org.geotools.feature.FeatureIterator; import
概述: 本文讲述geotools中的空间关系判断(Geometry Relationships)和空间操作(Geometry Operations)的编码实现。...空间关系(Geometry Relationships): 常见的空间关系(Geometry Relationships)包括:Disjoint、Intersects、Touches、Crosses、...空间操作(Geometry Operations): 常见的空间操作(Geometry Operations)包括:Buffer、Intersection、ConvexHull、Intersection...空间操作的计算结果展示如下: ? intersect ? union ? Difference ? SymDifference
作者:wh0am1i@知道创宇404实验室 日期:2023年6月29日 0x01 GeoServer & GeoTools 参考资料 GeoServer 是一个用 Java 编写的开源软件服务器,允许用户共享和编辑地理空间数据...GeoTools 是一个开源的 Java 库,提供对地理数据空间工具,GeoServer 许多核心功能使用 GeoTools 实现,如:数据读写转换。...下的 getReaderInternal() 函数对用户输入的查询进出处理,进一步调用 selectSQL 生成对应数据库的 SQL 查询语句,生成数据库的查询语句后,会对判断是否存在 CQL_FILTER...最终的整个漏洞的调用栈如下: :153, JDBCFeatureReader (org.geotools.jdbc) getReaderInternal:607, JDBCFeatureSource...而在 GeoTools 提交的补丁(https://github.com/geotools/geotools/commit/64fb4c47f43ca818c2fe96a94651bff1b3b3ed2b
概述: 本文说说geotools中坐标转换的那点事情,以WGS84和web墨卡托相互转换为例。 效果: ? 转换前 ? 转换后 ?...; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; import...; import org.geotools.geometry.jts.JTS; import org.geotools.geometry.jts.JTSFactoryFinder; import org.geotools.referencing.CRS...geom * @return */ public Geometry lonlat2WebMactor(Geometry geom){ try{ //这里是以OGC WKT形式定义的是...SimpleFeatureSource fs = shapeDS.getFeatureSource(shapeDS.getTypeNames()[0]); //下面这行还有其他写法,根据源shape文件的simpleFeatureType
简介 GeoTools 是英国利兹大学(University of Leeds)的James Macgll 从1996 年开始研发的一个操作和显示地图的开源Java 代码库, [1] 提供了一系列符合规范的操作地理空间数据的方法...GeoTools库在开发时执行OGC规范。目前GeoTools的最新版本是22-SNAPSHOT。 [2] GeoTools是一个开源的Java GIS工具包,可利用它来开发符合标准的地理信息系统。...GeoTools提供了OGC(Open Geospatial Consortium)规范的一个实现来作为他们的开发。 操作 本文主要写的是利用GeoTools 连接shp文件,并对其进行增删改。...由于过于简单,就当笔记记录一下,时间宝贵的同学就不要看了。 环境搭建 由于geotools是一个GIS类库,所以直接用maven进行构建就可以。...详细可以参考官方教程:http://docs.geotools.org/ 数据源DataStore 这个可以理解为平时Java连接数据的时候那个数据源。
概述 前文中,提到了等值面的生成,后面有人经常会问等值线的生成,本文在前文的基础上做了一点修改,完成了等值线的geotools生成。 效果 ? ?...; import com.lzugis.geotools.utils.FeaureUtil; import com.lzugis.geotools.utils.GeoJSONUtil; import com.vividsolutions.jts.geom.Geometry...; import org.geotools.data.FeatureSource; import org.geotools.data.shapefile.ShapefileDataStore; import...org.geotools.data.simple.SimpleFeatureCollection; import org.geotools.data.simple.SimpleFeatureSource...; import org.geotools.feature.FeatureCollection; import org.geotools.feature.FeatureIterator; import
概述 本文讲述如何结合geotools写一个类似于WMS的地图服务,并实现在OL4中的调用展示。 效果 ?...实现 后端代码 在后端,先创建一个MapContent,再添加一个layer并通过一个sld文件给layer设置样式,最后通过servlet实现WMS服务的转发,代码如下: package com.lzugis.web.servlet...; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.map.FeatureLayer; import org.geotools.map.Layer...; import org.geotools.map.MapContent; import org.geotools.referencing.CRS; import org.geotools.renderer.lite.StreamingRenderer...; import org.geotools.styling.SLD; import org.geotools.styling.SLDParser; import org.geotools.styling.Style
概述: 本文讲述如何结合geotools和POI实现Excel到shp的转换,再结合前文shp到geojson数据的转换,即可实现用户上传excel数据并在web端的展示功能。 截图: ?...; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore; import...org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.geotools.feature.simple.SimpleFeatureTypeBuilder...System.out.println("共耗时" + (System.currentTimeMillis() - start) + "ms"); } } 说明: 1、转换仅限点对象的转换...; 2、保留所有excel相关的属性,lon、lat字段是必须要有的; 3、对于中文字段,做了取首字母的处理;
概述 本文讲述在Java中,结合结合Geotools实现百度09,国测局02和经纬度shp数据的相互转换。 结果 ? ? ?...说明: 1、红色的线条是百度09的; 2、蓝色的线条是国测局02的; 3、填充的是原始wgs84的。...4、从图中可以看出,gcj02和wgs84的区别不是很大在一些不是很精确地情况下可以认为是一样的,bd09的区别稍微大一点; # 实现思路 由于坐标转换是单个点的,所以在处理一个shp的坐标转换的时候...,也是一个个点去做转换的。...; import org.geotools.data.FileDataStoreFactorySpi; import org.geotools.data.Transaction; import org.geotools.data.shapefile.ShapefileDataStore
领取专属 10元无门槛券
手把手带您无忧上云